/* Close up shop entirely. Note that this cannot be called unless cinfo->mem is non-NULL.  */
self_destruct(j_common_ptr cinfo)
/* Close up shop entirely. Note that this cannot be called unless cinfo->mem is non-NULL.  */
self_destruct(j_common_ptr cinfo)
{
    int pool;
    for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
        free_pool(cinfo, pool);
    }
    jpeg_free_small(cinfo, (void*)cinfo->mem, SIZEOF(my_memory_mgr));
    cinfo->mem = NULL;
    jpeg_mem_term(cinfo);
}