]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - jpeg.c
don't print "empty file" spam here
[xonotic/darkplaces.git] / jpeg.c
diff --git a/jpeg.c b/jpeg.c
index a248948f327685779d497767c045dc4d3de7986f..936bc5517aa379d67ac7b474b4d37c103d589499 100644 (file)
--- a/jpeg.c
+++ b/jpeg.c
@@ -990,6 +990,7 @@ static CompressedImageCacheItem *CompressedImageCache_Find(const char *imagename
                if(i->maxsize == maxsize)
                        if(!strcmp(i->imagename, imagename))
                                return i;
+               i = i->next;
        }
        return NULL;
 }
@@ -1047,6 +1048,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);