This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]