This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


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

Re: PATCH/RFA free(NULL) bomb in printcmd.c


Philippe De Muyter wrote:
> 
> Andrew Cagney wrote :
> > Um, I'm confused.  wouldn't it be easier to just delete the two cleanup
> > calls (the first, perhaphs, replaced with make_cleanup (null_cleanup,
> > NULL))?
> 
> Of course.  But I did not know if the number of cleanups mattered, so I made
> my change as small as possible.
> 
> [ 10 minutes reflexion and search ]
> 
> The current situation and my and your `fixes' would have caused memory leaks,
> because the intention of the programmer there was actually to `free (name)'
> and `free (filename)', but `make_cleanup' is called before `name' and `filename'
> are allocated.
> I now think I have the correct fix. OK to commit ?
> 
> Philippe De Muyter  <phdm@macqel.be>
> 
>         * printcmd.c (print_address_symbolic): Call `make_cleanup' with
>         `(free_current_contents, &x)', not `(free, x)'.
>         * utils.c (free_current_contents): Do not `free (NULL)'.

FYI,

Something wierd is going on.  For the d10v-elf target, FreeBSD 3.4
host.  I see the regression:

x/d &oct
0x2007dc0:	-1490098887
gdb in free(): warning: junk pointer, too high to make sense.
(gdb) FAIL: gdb.base/long_long.exp: x/d &oct

The warning appears all over the place.  It suggests that something is
corrupting one of those pointers.

	Andrew

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