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);
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