diff --git a/turbojpegl.c b/turbojpegl.c index c1c62f6e..7dd6a41a 100644 --- a/turbojpegl.c +++ b/turbojpegl.c @@ -294,6 +294,7 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h, -(unsigned long)(j->jdms.free_in_buffer); bailout: + if(j->cinfo.global_state>CSTATE_START) jpeg_abort_compress(&j->cinfo); if(row_pointer) free(row_pointer); for(i=0; idinfo); bailout: + if(j->dinfo.global_state>DSTATE_START) jpeg_abort_decompress(&j->dinfo); for(i=0; i