This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Memory leak in debug_tree
- From: Zack Weinberg <zack at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 06 May 2003 23:13:18 -0700
- Subject: Memory leak in debug_tree
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. */