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]

Re: [patch] c-common.c: Fix memory leak.


On Sat, 2004-12-11 at 10:30 -0500, Kazu Hirata wrote:
> Hi,
> 
> Attached is a patch to fix memory leak.
> 
> Consider the "if" statement shown in the patch.  If we are returning
> cstr.txt, nobody will ever reference namep, which is allocated via
> XVECNEW a few lines up.
> 
> The patch solves this problem by freeing namep with XDELETEVEC.
> 
> Tested on i686-pc-linux-gnu.  OK to apply?
> 
> Kazu Hirata
> 
> 2004-12-10  Kazu Hirata  <kazu@cs.umass.edu>
> 
> 	* c-common.c (fname_as_string): Free namep if we are returning
> 	cstr.text.
Approved.

You might want to put fixing the macro names to be more consistent
on the longer term todo list.
jeff



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