This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: PATCH/RFA free(NULL) bomb in printcmd.c
- To: Philippe De Muyter <phdm at macqel dot be>
- Subject: Re: PATCH/RFA free(NULL) bomb in printcmd.c
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Tue, 11 Apr 2000 11:11:17 +1000
- CC: "gdb-patches at sourceware dot cygnus dot com" <gdb-patches at sourceware dot cygnus dot com>
- Organization: Cygnus Solutions
- References: <200004101636.SAA28529@mail.macqel.be>
Philippe De Muyter wrote:
>
> printcmd.c contains hidden calls to free(NULL), that can crash on many OS'es;
> they are constructed by make_cleanup (free, name) calls, where `name' has
> the value NULL.
> - struct cleanup *cleanup_chain = make_cleanup (free, name);
> + struct cleanup *cleanup_chain = make_cleanup (null_cleanup, name);
> if (print_symbol_filename)
> - make_cleanup (free, filename);
> + make_cleanup (null_cleanup, filename);
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))?
Andrew