Ensure that libjpeg state is reset if an error occurs

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@437 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2011-02-24 21:16:10 +00:00
parent 6e51e19b1c
commit 582a46a59e

View File

@@ -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; i<MAX_COMPONENTS; i++)
{
@@ -576,6 +577,7 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
jpeg_finish_decompress(&j->dinfo);
bailout:
if(j->dinfo.global_state>DSTATE_START) jpeg_abort_decompress(&j->dinfo);
for(i=0; i<MAX_COMPONENTS; i++)
{
if(tmpbuf[i]) free(tmpbuf[i]);