This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
PATCH/RFA free(NULL) bomb in printcmd.c
- To: gdb-patches at sourceware dot cygnus dot com (gdb-patches at sourceware dot cygnus dot com)
- Subject: PATCH/RFA free(NULL) bomb in printcmd.c
- From: "Philippe De Muyter" <phdm at macqel dot be>
- Date: Mon, 10 Apr 2000 18:36:59 +0200 (CEST)
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.
Here is a fix. OK to commit ?
Philippe De Muyter <phdm@macqel.be>
* printcmd.c (print_address_symbolic): Set up dummy cleanups with
`null_cleanup (NULL)', not `free (NULL)'.
Index: gdb/printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.3
diff -u -p -r1.3 printcmd.c
--- printcmd.c 2000/04/04 04:16:48 1.3
+++ printcmd.c 2000/04/10 16:29:34
@@ -562,9 +562,9 @@ print_address_symbolic (addr, stream, do
int offset = 0;
int line = 0;
- 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);
if (build_address_symbolic (addr, do_demangle, &name, &offset, &filename, &line, &unmapped))
return;