summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2000-04-21 04:10:46 +0000
committerAndrew Cagney <cagney@redhat.com>2000-04-21 04:10:46 +0000
commit5470597faed057a0ac9bde4f90206024a840f4e4 (patch)
tree9dd50b131f6dcaa039d6a2eadfe86cf731d5db2a
parentcb6ae64aac60fe0a773de91f929b3e3bafd516f5 (diff)
downloadgdb-5470597faed057a0ac9bde4f90206024a840f4e4.tar.gz
* 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.
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/defs.h2
-rw-r--r--gdb/printcmd.c11
-rw-r--r--gdb/utils.c7
4 files changed, 25 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0e2ef6125bd..782df3db417 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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 Scott Bambrough <scottb@netwinder.org>
* arm-linux-nat.c (PIDGET, TIDGET): New.
diff --git a/gdb/defs.h b/gdb/defs.h
index 0270ddd1d8d..ca68d1bbdcc 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -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 *);
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 5068cc96c48..34e05cfb45f 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -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)
diff --git a/gdb/utils.c b/gdb/utils.c
index 1e081552f07..2868eacb15c 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -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