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 dd6b94f324b38c5a01d611925da43b04204cd8c4..1737bc421f4fa428f65043bbb1300b98a58ec27e 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 e9a76ad19627f58aa94bdb3046ba4675484f3e89..6661a3abc0216068a36e67bb616036c3c1134bb2 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) {