[gimp/gimp-2-6] Bug 606372 - Saving to .ppm fails on indexed colorspace



commit 26b185c31ebddb1a9c3a30eb6b60a15a5e3ed854
Author: Sven Neumann <sven gimp org>
Date:   Sat Jan 9 12:12:12 2010 +0100

    Bug 606372 - Saving to .ppm fails on indexed colorspace
    
    Don't change the pointer to the colormap and then attempt to free it.
    (cherry picked from commit b883d59411dfde28fb0704fa2790e602999f7f6f)

 plug-ins/common/file-pnm.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/plug-ins/common/file-pnm.c b/plug-ins/common/file-pnm.c
index 2cd8443..8359f0a 100644
--- a/plug-ins/common/file-pnm.c
+++ b/plug-ins/common/file-pnm.c
@@ -1103,13 +1103,14 @@ save_image (const gchar  *filename,
         }
       else
         {
-          gint i;
+          const guchar *c = cmap;
+          gint          i;
 
           for (i = 0; i < num_colors; i++)
             {
-              red[i] = *cmap++;
-              grn[i] = *cmap++;
-              blu[i] = *cmap++;
+              red[i] = *c++;
+              grn[i] = *c++;
+              blu[i] = *c++;
             }
 
           rowinfo.red = red;
@@ -1155,7 +1156,7 @@ save_image (const gchar  *filename,
           d = data;
         }
 
-      (*saverow)(&rowinfo, d);
+      saverow (&rowinfo, d);
       d += xres * (np ? np : 1);
 
       if ((ypos % 20) == 0)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]