[gimp/gimp-2-6] file-png: Check that PNG structs are created properly
- From: Nils Philippsen <nphilipp src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gimp/gimp-2-6] file-png: Check that PNG structs are created properly
- Date: Thu, 17 Nov 2011 16:01:48 +0000 (UTC)
commit 457d0afd121e84e7fff2583dac525c7a20b964c3
Author: Mukund Sivaraman <muks banu com>
Date:   Wed Sep 21 17:08:53 2011 +0530
    file-png: Check that PNG structs are created properly
    
    If there's a version mismatch between compiled version (header) and
    installed shared libpng library, structs are not created and NULL is
    returned.
    (cherry picked from commit 1ac6c7b85c461b29fc84c9ed5446e7ae98102e00)
 plug-ins/common/file-png.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index 98b62a5..ef0e38e 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -720,6 +720,14 @@ load_image (const gchar  *filename,
   gint       num_texts;
 
   pp = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+  if (!pp)
+    {
+      g_set_error (error, 0, 0,
+                   _("Error creating PNG read struct while saving '%s'."),
+                   gimp_filename_to_utf8 (filename));
+      return FALSE;
+    }
+
   info = png_create_info_struct (pp);
 
   if (setjmp (png_jmpbuf (pp)))
@@ -1247,6 +1255,14 @@ save_image (const gchar  *filename,
   png_textp  text = NULL;
 
   pp = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+  if (!pp)
+    {
+      g_set_error (error, 0, 0,
+                   _("Error creating PNG write struct while saving '%s'."),
+                   gimp_filename_to_utf8 (filename));
+      return FALSE;
+    }
+
   info = png_create_info_struct (pp);
 
   if (setjmp (png_jmpbuf (pp)))
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]