aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-03-13 21:02:58 +0000
committerTom Tromey <tromey@redhat.com>2009-03-13 21:02:58 +0000
commit9ee6bb930d0c1e44c3970965e0c981fa4c06dd8b (patch)
tree53002a02984616506544ba0ec0dc8f7ca2019a5c /gdb/symtab.c
parent787274f0421a2aafcf88122c379eceaf5888d8b5 (diff)
downloadgdb-9ee6bb930d0c1e44c3970965e0c981fa4c06dd8b.zip
gdb-9ee6bb930d0c1e44c3970965e0c981fa4c06dd8b.tar.gz
gdb-9ee6bb930d0c1e44c3970965e0c981fa4c06dd8b.tar.bz2
* symtab.c (lookup_symbol_in_language): Use a cleanup.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index d2ba1f3..7fff68a 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1197,8 +1197,8 @@ lookup_symbol_in_language (const char *name, const struct block *block,
char *demangled_name = NULL;
const char *modified_name = NULL;
const char *mangled_name = NULL;
- int needtofreename = 0;
struct symbol *returnval;
+ struct cleanup *cleanup = make_cleanup (null_cleanup, 0);
modified_name = name;
@@ -1211,7 +1211,7 @@ lookup_symbol_in_language (const char *name, const struct block *block,
{
mangled_name = name;
modified_name = demangled_name;
- needtofreename = 1;
+ make_cleanup (xfree, demangled_name);
}
}
else if (lang == language_java)
@@ -1222,7 +1222,7 @@ lookup_symbol_in_language (const char *name, const struct block *block,
{
mangled_name = name;
modified_name = demangled_name;
- needtofreename = 1;
+ make_cleanup (xfree, demangled_name);
}
}
@@ -1241,8 +1241,7 @@ lookup_symbol_in_language (const char *name, const struct block *block,
returnval = lookup_symbol_aux (modified_name, mangled_name, block,
domain, lang, is_a_field_of_this);
- if (needtofreename)
- xfree (demangled_name);
+ do_cleanups (cleanup);
return returnval;
}