This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix a leak in the C front-end
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: Thu, 1 Jan 2004 21:39:30 -0500
- Subject: [PATCH] Fix a leak in the C front-end
This is the first patch in a series of fixing memory leak problems in
GCC where GCC
does not use GC memory.
I used the testcase in PR 12440 which is about excessive memory usage
in GCC, these
patches should make GCC use less memory at the same time which causes
the ICEs.
After this patch there was no leaks with the testcase at -O0.
Bootstrapped and tested on powerpc-apple-darwin7.2.0 with no
regressions.
Ok for the mainline?
Thanks,
Andrew Pinski
ChangeLog:
* c-typeck.c (finish_init): Free spelling_base before setting it again.
Index: c-typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v
retrieving revision 1.267
diff -u -p -r1.267 c-typeck.c
--- c-typeck.c 23 Dec 2003 05:26:40 -0000 1.267
+++ c-typeck.c 2 Jan 2004 02:26:06 -0000
@@ -4450,6 +4450,8 @@ finish_init (void)
abort ();
/* Pop back to the data of the outer initializer (if any). */
+ free (spelling_base);
+
constructor_decl = p->decl;
constructor_asmspec = p->asmspec;
require_constant_value = p->require_constant_value;