Commit 5e142f81 authored by DRC's avatar DRC Committed by Johannes Schindelin

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: 's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
parent 729e965d
...@@ -601,7 +601,7 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, ...@@ -601,7 +601,7 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf,
bailout: bailout:
if(cinfo->global_state>CSTATE_START) jpeg_abort_compress(cinfo); if(cinfo->global_state>CSTATE_START) jpeg_abort_compress(cinfo);
#ifndef JCS_EXTENSIONS #ifndef JCS_EXTENSIONS
if(rgbBuf && rgbBuf!=srcBuf) free(rgbBuf); if(rgbBuf) free(rgbBuf);
#endif #endif
if(row_pointer) free(row_pointer); if(row_pointer) free(row_pointer);
return retval; return retval;
...@@ -835,7 +835,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf, ...@@ -835,7 +835,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf,
bailout: bailout:
if(dinfo->global_state>DSTATE_START) jpeg_abort_decompress(dinfo); if(dinfo->global_state>DSTATE_START) jpeg_abort_decompress(dinfo);
#ifndef JCS_EXTENSIONS #ifndef JCS_EXTENSIONS
if(rgbBuf && rgbBuf!=dstBuf) free(rgbBuf); if(rgbBuf) free(rgbBuf);
#endif #endif
if(row_pointer) free(row_pointer); if(row_pointer) free(row_pointer);
return retval; return retval;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment