From faab992242207dfee20afc307aabb28e6e6bfe7f Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sun, 5 May 2013 16:54:26 +0000 Subject: [PATCH] gdb/ * event-top.c (display_gdb_prompt): Call missing do_cleanups. * infcmd.c (get_return_value) : Do not overwrite CLEANUP. * symfile.c (symfile_bfd_open): New variable back_to. Do not leave a stale cleanup. Fix double free of NAME. --- gdb/ChangeLog | 7 +++++++ gdb/event-top.c | 1 + gdb/infcmd.c | 2 +- gdb/symfile.c | 12 ++++++------ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 44d028e72d7..75b205c9f95 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2013-05-05 Jan Kratochvil + + * event-top.c (display_gdb_prompt): Call missing do_cleanups. + * infcmd.c (get_return_value) : Do not overwrite CLEANUP. + * symfile.c (symfile_bfd_open): New variable back_to. Do not leave + a stale cleanup. Fix double free of NAME. + 2013-05-04 Eli Zaretskii * windows-nat.c (windows_delete_thread): Accept an additional diff --git a/gdb/event-top.c b/gdb/event-top.c index 10f14993b55..f00ab7d84e1 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -269,6 +269,7 @@ display_gdb_prompt (char *new_prompt) rl_callback_handler_remove(), does the job. */ rl_callback_handler_remove (); + do_cleanups (old_chain); return; } else diff --git a/gdb/infcmd.c b/gdb/infcmd.c index af6a4db0951..11cdf627937 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1452,7 +1452,7 @@ get_return_value (struct value *function, struct type *value_type) if (!stop_regs) { stop_regs = regcache_dup (get_current_regcache ()); - cleanup = make_cleanup_regcache_xfree (stop_regs); + make_cleanup_regcache_xfree (stop_regs); } gdbarch = get_regcache_arch (stop_regs); diff --git a/gdb/symfile.c b/gdb/symfile.c index 979a8dd0a51..13740df0ea1 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1698,6 +1698,7 @@ symfile_bfd_open (char *name) bfd *sym_bfd; int desc; char *absolute_name; + struct cleanup *back_to; if (remote_filename_p (name)) { @@ -1739,15 +1740,12 @@ symfile_bfd_open (char *name) xfree (name); name = absolute_name; - make_cleanup (xfree, name); + back_to = make_cleanup (xfree, name); sym_bfd = gdb_bfd_open (name, gnutarget, desc); if (!sym_bfd) - { - make_cleanup (xfree, name); - error (_("`%s': can't open to read symbols: %s."), name, - bfd_errmsg (bfd_get_error ())); - } + error (_("`%s': can't open to read symbols: %s."), name, + bfd_errmsg (bfd_get_error ())); bfd_set_cacheable (sym_bfd, 1); if (!bfd_check_format (sym_bfd, bfd_object)) @@ -1757,6 +1755,8 @@ symfile_bfd_open (char *name) bfd_errmsg (bfd_get_error ())); } + do_cleanups (back_to); + return sym_bfd; } -- 2.30.2