From: divverent Date: Sat, 4 Apr 2009 12:48:05 +0000 (+0000) Subject: fix a memory leak in WriteImage X-Git-Tag: xonotic-v0.1.0preview~1756 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=df96b349fde7b0bec3f3671cc8f74ca949ca6407;p=xonotic%2Fdarkplaces.git fix a memory leak in WriteImage git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8851 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/jpeg.c b/jpeg.c index a248948f..70051190 100644 --- a/jpeg.c +++ b/jpeg.c @@ -1047,6 +1047,8 @@ qboolean Image_Compress(const char *imagename, size_t maxsize, void **buf, size_ // try to compress it to JPEG *buf = Z_Malloc(maxsize); *size = JPEG_SaveImage_to_Buffer((char *) *buf, maxsize, image_width, image_height, newimagedata); + Mem_Free(newimagedata); + if(!*size) { Z_Free(*buf);