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]

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


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;

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