]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - jpeg.c
fix a memory leak in WriteImage
[xonotic/darkplaces.git] / jpeg.c
diff --git a/jpeg.c b/jpeg.c
index a248948f327685779d497767c045dc4d3de7986f..700511905393526c4fdb563db80d0ff47b86a697 100644 (file)
--- 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);