X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=jpeg.c;h=c85c90a681f825e586cd87d9898a25e2979b097e;hb=12ca8e9cda940140f95445aa8967e214fee87714;hp=7e503d3b4d24ce85748762aeaeaee7534a2fdd7d;hpb=ea3f4513f96a21ae1bcbaae4a4997968ace1ab95;p=xonotic%2Fdarkplaces.git diff --git a/jpeg.c b/jpeg.c index 7e503d3b..c85c90a6 100644 --- 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