From c89ffd862078b73a03cb0fedb435f87dd0c03506 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Thu, 17 Jan 2013 19:55:18 +0000 Subject: [PATCH] gdb/ * symtab.c (iterate_over_some_symtabs): New variable cleanups, initialize it by existing make_cleanup. Call new do_cleanups. --- gdb/ChangeLog | 5 +++++ gdb/symtab.c | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a98621c3fb7..e9f2e7cf92c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2013-01-17 Jan Kratochvil + + * symtab.c (iterate_over_some_symtabs): New variable cleanups, + initialize it by existing make_cleanup. Call new do_cleanups. + 2013-01-17 Tom Tromey * cp-abi.c (cp_abi_completer): New function. diff --git a/gdb/symtab.c b/gdb/symtab.c index f4ed8b98aa4..c304f70b6a4 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -241,19 +241,26 @@ iterate_over_some_symtabs (const char *name, { const char *fullname = symtab_to_fullname (s); char *rp = gdb_realpath (fullname); + struct cleanup *cleanups = make_cleanup (xfree, rp); - make_cleanup (xfree, rp); if (FILENAME_CMP (real_path, rp) == 0) { if (callback (s, data)) - return 1; + { + do_cleanups (cleanups); + return 1; + } } if (!is_abs && compare_filenames_for_search (rp, name)) { if (callback (s, data)) - return 1; + { + do_cleanups (cleanups); + return 1; + } } + do_cleanups (cleanups); } } -- 2.30.2