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] reg-stack.c: Fix a memory leak.


Hi,

Attached is a patch to fix a memory leak.

convert_regs_2 uses a worklist named "stack" of basic blocks.  We need
to free it when we are done.

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

Kazu Hirata

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

	* reg-stack.c (convert_regs_2): Free stack.

Index: reg-stack.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reg-stack.c,v
retrieving revision 1.168
diff -u -d -p -r1.168 reg-stack.c
--- reg-stack.c	30 Nov 2004 02:34:56 -0000	1.168
+++ reg-stack.c	11 Dec 2004 01:48:07 -0000
@@ -3005,6 +3005,8 @@ convert_regs_2 (FILE *file, basic_block 
     }
   while (sp != stack);
 
+  free (stack);
+
   return inserted;
 }
 


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