]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - jpeg.c
batch by lightmap rather than by use of lightmaps (batching by use of
[xonotic/darkplaces.git] / jpeg.c
diff --git a/jpeg.c b/jpeg.c
index 7e503d3b4d24ce85748762aeaeaee7534a2fdd7d..c85c90a681f825e586cd87d9898a25e2979b097e 100644 (file)
--- a/jpeg.c
+++ b/jpeg.c
@@ -534,8 +534,10 @@ unsigned char* JPEG_LoadImage (const unsigned char *f, int filesize, int matchwi
        scanline = (unsigned char *)Mem_Alloc(tempmempool, image_width * cinfo.output_components);
        if (!image_rgba || !scanline)
        {
-               if (!image_rgba)
+               if (image_rgba)
                        Mem_Free (image_rgba);
+               if (scanline)
+                       Mem_Free (scanline);
 
                Con_Printf("JPEG_LoadImage: not enough memory for %i by %i image\n", image_width, image_height);
                qjpeg_finish_decompress (&cinfo);
@@ -690,7 +692,7 @@ qboolean JPEG_SaveImage_preflipped (const char *filename, int width, int height,
        cinfo.in_color_space = JCS_RGB;
        cinfo.input_components = 3;
        qjpeg_set_defaults (&cinfo);
-       qjpeg_set_quality (&cinfo, scr_screenshot_jpeg_quality.value * 100, TRUE);
+       qjpeg_set_quality (&cinfo, (int)(scr_screenshot_jpeg_quality.value * 100), TRUE);
        qjpeg_start_compress (&cinfo, true);
 
        // Compress each scanline