have error.c free a non-leak when using the debug malloc
authorTony Cook <tony@develop=help.com>
Thu, 1 Nov 2001 14:27:40 +0000 (14:27 +0000)
committerTony Cook <tony@develop=help.com>
Thu, 1 Nov 2001 14:27:40 +0000 (14:27 +0000)
have malloc_state() call i_clear_error() to make sure that is triggered

error.c
io.c

diff --git a/error.c b/error.c
index dd6b94f..1737bc4 100644 (file)
--- a/error.c
+++ b/error.c
@@ -186,6 +186,17 @@ Called by any imager function before doing any other processing.
 
 =cut */
 void i_clear_error() {
+#ifdef IMAGER_DEBUG_MALLOC
+  int i;
+
+  for (i = 0; i < ERRSTK; ++i) {
+    if (error_space[i]) {
+      myfree(error_stack[i].msg);
+      error_stack[i].msg = NULL;
+      error_space[i] = 0;
+    }
+  }
+#endif
   error_sp = ERRSTK-1;
 }
 
diff --git a/io.c b/io.c
index e9a76ad..6661a3a 100644 (file)
--- a/io.c
+++ b/io.c
@@ -79,6 +79,7 @@ void
 malloc_state(void) {
   int i, total = 0;
 
+  i_clear_error();
   mm_log((0,"malloc_state()\n"));
   bndcheck_all();
   for(i=0; i<MAXMAL; i++) if (malloc_pointers[i].ptr != NULL) {