aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2013-05-22 21:16:18 +0000
committerKeith Seitz <keiths@redhat.com>2013-05-22 21:16:18 +0000
commit55b87a526f450f811090fe38c80965ac615bf661 (patch)
tree6db6ba6c14b5aa8471998374dcc7dd5fadecf9b0 /gdb/ada-lang.c
parent5f2e6b00f863fc8f334d2506b96b055ef70394ed (diff)
downloadgdb-55b87a526f450f811090fe38c80965ac615bf661.zip
gdb-55b87a526f450f811090fe38c80965ac615bf661.tar.gz
gdb-55b87a526f450f811090fe38c80965ac615bf661.tar.bz2
* ada-lang.c (is_known_support_routine): Add explicit free of
'func_name' from find_frame_funname. (ada_unhandled_exception_name_addr_from_raise): Add cleanups for func_name from find_frame_funname. * python/py-frame.c (frapy_name): Add explicit free of 'name' from find_frame_funname. * stack.c (find_frame_funname): Add comment explaining that funcp must be freed by the caller. Return copy of symbol names instead of pointers. (print_frame): Add a cleanup for 'funname' from find_frame_funname. * stack.h (find_frame_funname): Remove "const" from 'funname' parameter.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index b6d5e0b..8240fee 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -11113,7 +11113,7 @@ static int
is_known_support_routine (struct frame_info *frame)
{
struct symtab_and_line sal;
- const char *func_name;
+ char *func_name;
enum language func_lang;
int i;
const char *fullname;
@@ -11160,9 +11160,13 @@ is_known_support_routine (struct frame_info *frame)
{
re_comp (known_auxiliary_function_name_patterns[i]);
if (re_exec (func_name))
- return 1;
+ {
+ xfree (func_name);
+ return 1;
+ }
}
+ xfree (func_name);
return 0;
}
@@ -11206,6 +11210,7 @@ ada_unhandled_exception_name_addr_from_raise (void)
int frame_level;
struct frame_info *fi;
struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ());
+ struct cleanup *old_chain;
/* To determine the name of this exception, we need to select
the frame corresponding to RAISE_SYM_NAME. This frame is
@@ -11216,17 +11221,24 @@ ada_unhandled_exception_name_addr_from_raise (void)
if (fi != NULL)
fi = get_prev_frame (fi);
+ old_chain = make_cleanup (null_cleanup, NULL);
while (fi != NULL)
{
- const char *func_name;
+ char *func_name;
enum language func_lang;
find_frame_funname (fi, &func_name, &func_lang, NULL);
- if (func_name != NULL
- && strcmp (func_name, data->exception_info->catch_exception_sym) == 0)
- break; /* We found the frame we were looking for... */
- fi = get_prev_frame (fi);
+ if (func_name != NULL)
+ {
+ make_cleanup (xfree, func_name);
+
+ if (strcmp (func_name,
+ data->exception_info->catch_exception_sym) == 0)
+ break; /* We found the frame we were looking for... */
+ fi = get_prev_frame (fi);
+ }
}
+ do_cleanups (old_chain);
if (fi == NULL)
return 0;