From 8ac3b534fb48f46251e7471d7a4e343d57369c6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Fri, 19 Mar 1999 03:11:36 -0800
Subject: [PATCH] bugfix by Mirar

Rev: src/modules/Image/colortable.c:1.50
---
 src/modules/Image/colortable.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/modules/Image/colortable.c b/src/modules/Image/colortable.c
index 2d583cb3ec..5a5fa07500 100644
--- a/src/modules/Image/colortable.c
+++ b/src/modules/Image/colortable.c
@@ -1,12 +1,12 @@
 #include "global.h"
 #include <config.h>
 
-/* $Id: colortable.c,v 1.49 1999/02/22 01:24:13 mirar Exp $ */
+/* $Id: colortable.c,v 1.50 1999/03/19 11:11:36 hubbe Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: colortable.c,v 1.49 1999/02/22 01:24:13 mirar Exp $
+**!	$Id: colortable.c,v 1.50 1999/03/19 11:11:36 hubbe Exp $
 **! class colortable
 **!
 **!	This object keeps colortable information,
@@ -21,7 +21,7 @@
 #undef COLORTABLE_DEBUG
 #undef COLORTABLE_REDUCE_DEBUG
 
-RCSID("$Id: colortable.c,v 1.49 1999/02/22 01:24:13 mirar Exp $");
+RCSID("$Id: colortable.c,v 1.50 1999/03/19 11:11:36 hubbe Exp $");
 
 #include <math.h> /* fabs() */
 
@@ -101,6 +101,20 @@ static void colortable_free_lookup_stuff(struct neo_colortable *nct)
    }
 }
 
+static void colortable_free_dither_union(struct neo_colortable *nct)
+{
+  switch (nct->dither_type)
+  {
+    case NCTD_ORDERED:
+      free(nct->du.ordered.rdiff);
+      free(nct->du.ordered.gdiff);
+      free(nct->du.ordered.bdiff);
+      break;
+    default:
+      ;
+  }
+}
+
 static void free_colortable_struct(struct neo_colortable *nct)
 {
    struct nct_scale *s;
@@ -122,6 +136,8 @@ static void free_colortable_struct(struct neo_colortable *nct)
 	 nct->type=NCT_NONE;
          return; /* done */
    }
+
+   colortable_free_dither_union(nct);
 }
 
 static void colortable_init_stuff(struct neo_colortable *nct)
@@ -3810,6 +3826,7 @@ void image_colortable_ordered(INT32 args)
    int r,g,b;
    int xsize,ysize;
 
+   colortable_free_dither_union(THIS);
    THIS->dither_type=NCTD_NONE;
 
    if (args>=3) 
-- 
GitLab