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] tree-into-ssa.c: Fix memory leak.


Hi,

Attached is a patch to fix memory leak.

get_ssa_name_ann, one of rewrite_ssa_into_ssa's children, allocates
SSA_NAME_AUX on heap.  If we are releasing an SSA_NAME, we have to
free SSA_NAME_AUX before we release it.

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-12-10  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-into-ssa.c (rewrite_ssa_into_ssa): Free SSA_NAME_AUX
	before we release an SSA_NAME.

Index: tree-into-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-into-ssa.c,v
retrieving revision 2.34
diff -u -d -p -r2.34 tree-into-ssa.c
--- tree-into-ssa.c	29 Nov 2004 20:02:07 -0000	2.34
+++ tree-into-ssa.c	10 Dec 2004 15:39:34 -0000
@@ -1726,6 +1726,11 @@ rewrite_ssa_into_ssa (void)
 
   EXECUTE_IF_SET_IN_BITMAP (to_rename, 0, i, bi)
     {
+      /* Free SSA_NAME_AUX.  We don't have to zero it because
+	 release_ssa_name will.  */
+      if (SSA_NAME_AUX (ssa_name (i)))
+	free (SSA_NAME_AUX (ssa_name (i)));
+
       release_ssa_name (ssa_name (i));
     }
 


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