Memory leak in debug_tree

Zack Weinberg zack@codesourcery.com
Wed May 7 06:13:00 GMT 2003


While debugging execute/920501-5.c I found a memory leak in
debug_tree.

zw

        * print-tree.c (debug_tree): Free the table after we're done
        with it.  Use putc.

===================================================================
Index: print-tree.c
--- print-tree.c	14 Apr 2003 03:13:07 -0000	1.68
+++ print-tree.c	7 May 2003 06:12:51 -0000
@@ -52,8 +52,9 @@ debug_tree (node)
 {
   table = (struct bucket **) xcalloc (HASH_SIZE, sizeof (struct bucket *));
   print_node (stderr, "", node, 0);
+  free (table);
   table = 0;
-  fprintf (stderr, "\n");
+  putc ('\n', stderr);
 }
 
 /* Print a node in brief fashion, with just the code, address and name.  */



More information about the Gcc-patches mailing list