* defs.h, utils.c (free_current_contents): Change parameter to
authorAndrew Cagney <cagney@redhat.com>
Fri, 21 Apr 2000 04:10:18 +0000 (04:10 +0000)
committerAndrew Cagney <cagney@redhat.com>
Fri, 21 Apr 2000 04:10:18 +0000 (04:10 +0000)
void*.

From 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)'.

* printcmd.c (print_address_symbolic): Cleanup after a failed
call to build_address_symbolic.

gdb/ChangeLog
gdb/defs.h
gdb/printcmd.c
gdb/utils.c

index 0f1f773541df23f2439754886bd0370b8179d48b..dd196761105deac5d05c6bd2adde1b60c3d29519 100644 (file)
@@ -1,3 +1,16 @@
+Thu Apr 20 17:39:11 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * defs.h, utils.c (free_current_contents): Change parameter to
+       void*.
+
+       From 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)'.
+
+       * printcmd.c (print_address_symbolic): Cleanup after a failed
+       call to build_address_symbolic.
+
 2000-04-20  Christopher Faylor  <cgf@cygnus.com>
 
        * wince-stub.c (FREE): New macro.
index 86ad0f77415550251b661d8fd8885f99928eb93e..ff23f609d8db5a5601d102d19731b860157a13d7 100644 (file)
@@ -354,7 +354,7 @@ extern void restore_cleanups (struct cleanup *);
 extern void restore_final_cleanups (struct cleanup *);
 extern void restore_my_cleanups (struct cleanup **, struct cleanup *);
 
-extern void free_current_contents (char **);
+extern void free_current_contents (void *);
 
 extern void null_cleanup (void *);
 
index ff4ff36ecacb9a9f36af0ce435dcd87e1de6d538..a74ffa2c370007ca0ec0bd3ea1ea1a6cb8284a99 100644 (file)
@@ -562,12 +562,15 @@ print_address_symbolic (addr, stream, do_demangle, leadin)
   int offset = 0;
   int line = 0;
 
-  struct cleanup *cleanup_chain = make_cleanup (free, name);
-  if (print_symbol_filename)
-    make_cleanup (free, filename);
+  /* throw away both name and filename */
+  struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &name);
+  make_cleanup (free_current_contents, &filename);
 
   if (build_address_symbolic (addr, do_demangle, &name, &offset, &filename, &line, &unmapped))
-    return;
+    {
+      do_cleanups (cleanup_chain);
+      return;
+    }
 
   fputs_filtered (leadin, stream);
   if (unmapped)
index 1e081552f07dd7f156d3fffeedacd56f5b667cf2..2868eacb15cd64bf64102820abfc0bd44cee18fd 100644 (file)
@@ -375,10 +375,11 @@ restore_my_cleanups (pmy_chain, chain)
    to arrange to free the object thus allocated.  */
 
 void
-free_current_contents (location)
-     char **location;
+free_current_contents (void *ptr)
 {
-  free (*location);
+  void **location = ptr;
+  if (*location != NULL)
+    free (*location);
 }
 
 /* Provide a known function that does nothing, to use as a base for