Public feed #722939

Zeug

public text v1 · immutable
Raw Edit
·published 2007-10-02 13:13 UTC
rendered paste body
diff --git a/imgjpeg.c b/imgjpeg.c
index de66127..620dc9b 100644
--- a/imgjpeg.c
+++ b/imgjpeg.c
@@ -137,7 +137,11 @@ readJPEGFileToImage (FILE *file,
     jpeg_create_decompress (&cinfo);
 
     jpeg_stdio_src (&cinfo, file);
-    jpeg_read_header (&cinfo, TRUE);
+    if (jpeg_read_header (&cinfo, TRUE) != JPEG_HEADER_OK)
+    {
+	jpeg_destroy_decompress (&cinfo);
+	return FALSE;
+    }
 
     cinfo.out_color_space = JCS_RGB;
 
@@ -210,7 +214,7 @@ writeJPEG (CompDisplay *d,
     cinfo.in_color_space   = JCS_RGB;
 
     jpeg_set_defaults (&cinfo);
-    jpeg_set_quality (&cinfo, imgjpegGetQuality(d), TRUE);
+    jpeg_set_quality (&cinfo, imgjpegGetQuality (d), TRUE);
     jpeg_start_compress (&cinfo, TRUE);
 
     while (cinfo.next_scanline < cinfo.image_height)