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]

[PATCH] Fix memory leak in DOM


A simple memory leak plug.

OK? Bootstrapped and tested on powerpc-darwin.


ChangeLog: * tree-ssa-dom.c (record_range): Free the element if we are not going to use it.

Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v
retrieving revision 2.58
diff -u -p -r2.58 tree-ssa-dom.c
--- tree-ssa-dom.c	4 Oct 2004 13:19:20 -0000	2.58
+++ tree-ssa-dom.c	12 Oct 2004 14:39:46 -0000
@@ -3013,6 +3013,8 @@ record_range (tree cond, basic_block bb)

       if (*slot == NULL)
 	*slot = (void *) vrp_hash_elt;
+      else
+	free (vrp_hash_elt);

       vrp_hash_elt = (struct vrp_hash_elt *) *slot;
       vrp_records_p = &vrp_hash_elt->records;


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