Fix memory leak in TurboVNC

Note that the memory leak was only occurring with the colorspace
emulation code, which is only active when using regular libjpeg (not
libjpeg-turbo.)

Diagnosed by Christian Beier, using valgrind.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
pull/1/head
DRC 13 years ago committed by Johannes Schindelin
parent 729e965dff
commit 5e142f81a9

@ -601,7 +601,7 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf,
bailout:
if(cinfo->global_state>CSTATE_START) jpeg_abort_compress(cinfo);
#ifndef JCS_EXTENSIONS
if(rgbBuf && rgbBuf!=srcBuf) free(rgbBuf);
if(rgbBuf) free(rgbBuf);
#endif
if(row_pointer) free(row_pointer);
return retval;
@ -835,7 +835,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf,
bailout:
if(dinfo->global_state>DSTATE_START) jpeg_abort_decompress(dinfo);
#ifndef JCS_EXTENSIONS
if(rgbBuf && rgbBuf!=dstBuf) free(rgbBuf);
if(rgbBuf) free(rgbBuf);
#endif
if(row_pointer) free(row_pointer);
return retval;

Loading…
Cancel
Save