This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] c-exp.y, memory leak
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: msnyder at sonic dot net
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 5 Aug 2007 20:52:00 +0200 (CEST)
- Subject: Re: [PATCH] c-exp.y, memory leak
- References: <9892.12.7.175.2.1186278669.squirrel@webmail.sonic.net>
> Date: Sat, 4 Aug 2007 18:51:09 -0700 (PDT)
> From: msnyder@sonic.net
>
> 2007-08-04 Michael Snyder <msnyder@access-company.com>
>
> * c-exp.y (parse_number): Memory leak.
Shouldn't this use xfree()?
> Index: c-exp.y
> ===================================================================
> RCS file: /cvs/src/src/gdb/c-exp.y,v
> retrieving revision 1.38
> diff -p -r1.38 c-exp.y
> *** c-exp.y 12 Jun 2007 15:33:03 -0000 1.38
> --- c-exp.y 5 Aug 2007 01:49:51 -0000
> *************** parse_number (p, len, parsed_float, puti
> *** 1096,1104 ****
> putithere->typed_val_float.type =
> builtin_type (current_gdbarch)->builtin_long_double;
> else
> ! return ERROR;
> }
>
> return FLOAT;
> }
>
> --- 1096,1108 ----
> putithere->typed_val_float.type =
> builtin_type (current_gdbarch)->builtin_long_double;
> else
> ! {
> ! free (s);
> ! return ERROR;
> ! }
> }
>
> + free (s);
> return FLOAT;
> }