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] regmove.c: Fix memory leak.


Hi,

Attached is a patch to fix memory leak.

In combine_stack_adjustments_for_block, we set memlist to NULL if we
free it during the course of the function.  So, if memlist isn't NULL
at the end of the function, that means we haven't freed it yet.

The patch frees memlist if it hasn't been freed.

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

Kazu Hirata

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

	* regmove.c (combine_stack_adjustments_for_block): Free
	memlist if it hasn't been freed.

Index: regmove.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regmove.c,v
retrieving revision 1.165
diff -u -d -p -r1.165 regmove.c
--- regmove.c	16 Nov 2004 21:11:33 -0000	1.165
+++ regmove.c	10 Dec 2004 07:47:53 -0000
@@ -2457,4 +2457,7 @@ combine_stack_adjustments_for_block (bas
 
   if (last_sp_set && last_sp_adjust == 0)
     delete_insn (last_sp_set);
+
+  if (memlist)
+    free_csa_memlist (memlist);
 }


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