summaryrefslogtreecommitdiffstats
path: root/common/turbojpeg.c
diff options
context:
space:
mode:
authorDRC <information@virtualgl.org>2012-04-09 15:26:46 -0500
committerJohannes Schindelin <johannes.schindelin@gmx.de>2012-04-09 15:27:58 -0500
commit5e142f81a9fd30b1b360032779ff1cc9be83aa84 (patch)
tree945f3f893d7ed1261f16001ff2096746f4456321 /common/turbojpeg.c
parent729e965dfff52bf8d76b609c068fbcb36910456f (diff)
downloadlibtdevnc-5e142f81a9fd30b1b360032779ff1cc9be83aa84.tar.gz
libtdevnc-5e142f81a9fd30b1b360032779ff1cc9be83aa84.zip
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>
Diffstat (limited to 'common/turbojpeg.c')
-rw-r--r--common/turbojpeg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/turbojpeg.c b/common/turbojpeg.c
index c145338..11168a2 100644
--- a/common/turbojpeg.c
+++ b/common/turbojpeg.c
@@ -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;