/* Everything gets deallocated except the master jpeg_compress_struct itself and the error manager struct. Both of these are supplied by the application and must be freed, if necessary, by the application. (Often they are on the stack and so don't need to be freed anyway.) Closing a data source or destination, if necessary, is the application's responsibility.  */
jpeg_destroy(j_common_ptr cinfo)
/* Everything gets deallocated except the master jpeg_compress_struct itself and the error manager struct. Both of these are supplied by the application and must be freed, if necessary, by the application. (Often they are on the stack and so don't need to be freed anyway.) Closing a data source or destination, if necessary, is the application's responsibility.  */
jpeg_destroy(j_common_ptr cinfo)
{
    if (cinfo->mem != NULL)
        (*cinfo->mem->self_destruct) (cinfo);
    cinfo->mem = NULL;
    cinfo->global_state = 0;
}