aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2013-05-21 05:41:31 +0000
committerJoel Brobecker <brobecker@gnat.com>2013-05-21 05:41:31 +0000
commit1509e5737f8b0d499117aefbd68ca8e9548f701f (patch)
tree8efa5c863f4dec16a56759f24dbd1406cd3a82f8 /gdb/ada-lang.c
parentc5867ab65ce98cb27943606d66eee564c60a7d23 (diff)
downloadgdb-1509e5737f8b0d499117aefbd68ca8e9548f701f.zip
gdb-1509e5737f8b0d499117aefbd68ca8e9548f701f.tar.gz
gdb-1509e5737f8b0d499117aefbd68ca8e9548f701f.tar.bz2
[Ada] Fix cleanup leak in ada-lang.c:old_renaming_is_invisible
gdb/ChangeLog: * ada-lang.c (old_renaming_is_invisible): Fix cleanup leak.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index fa6db0f..b6d5e0b 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4726,17 +4726,20 @@ static int
old_renaming_is_invisible (const struct symbol *sym, const char *function_name)
{
char *scope;
+ struct cleanup *old_chain;
if (SYMBOL_CLASS (sym) != LOC_TYPEDEF)
return 0;
scope = xget_renaming_scope (SYMBOL_TYPE (sym));
-
- make_cleanup (xfree, scope);
+ old_chain = make_cleanup (xfree, scope);
/* If the rename has been defined in a package, then it is visible. */
if (is_package_name (scope))
- return 0;
+ {
+ do_cleanups (old_chain);
+ return 0;
+ }
/* Check that the rename is in the current function scope by checking
that its name starts with SCOPE. */
@@ -4748,7 +4751,12 @@ old_renaming_is_invisible (const struct symbol *sym, const char *function_name)
if (strncmp (function_name, "_ada_", 5) == 0)
function_name += 5;
- return (strncmp (function_name, scope, strlen (scope)) != 0);
+ {
+ int is_invisible = strncmp (function_name, scope, strlen (scope)) != 0;
+
+ do_cleanups (old_chain);
+ return is_invisible;
+ }
}
/* Remove entries from SYMS that corresponds to a renaming entity that