From ff2757dff8254581de5426b1aff5d8f3996908f1 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 31 Mar 2003 09:34:02 +0000 Subject: [PATCH] free the original cmap pointer, not the one we used for iteration (fixes 2003-03-31 Michael Natterer * plug-ins/common/xpm.c (save_image): free the original cmap pointer, not the one we used for iteration (fixes bug #109567). --- ChangeLog | 5 +++++ plug-ins/common/xpm.c | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e325ffbf39..7e5fe5d6e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-03-31 Michael Natterer + + * plug-ins/common/xpm.c (save_image): free the original cmap + pointer, not the one we used for iteration (fixes bug #109567). + 2003-03-31 Michael Natterer * app/core/gimpdrawable-transform-utils.c diff --git a/plug-ins/common/xpm.c b/plug-ins/common/xpm.c index 60940d5a9d..e3b508385d 100644 --- a/plug-ins/common/xpm.c +++ b/plug-ins/common/xpm.c @@ -16,9 +16,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* XPM plugin version 1.2.5 */ +/* XPM plugin version 1.2.6 */ /* +1.2.6 fixes crash when saving indexed images (bug #109567) + 1.2.5 only creates a "None" color entry if the image has alpha (bug #108034) 1.2.4 displays an error message if saving fails (bug #87588) @@ -667,6 +669,9 @@ save_image (gchar *filename, if (indexed) { guchar *cmap = gimp_image_get_cmap (image_ID, &ncolors); + guchar *c; + + c = cmap; if (alpha) ncolors++; @@ -683,9 +688,9 @@ save_image (gchar *filename, gchar *string; guchar r, g, b; - r = *(cmap++); - g = *(cmap++); - b = *(cmap++); + r = *c++; + g = *c++; + b = *c++; string = g_new (gchar, 8); sprintf (string, "#%02X%02X%02X", (int)r, (int)g, (int)b);