aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-frame.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/python/py-frame.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/python/py-frame.c')
-rw-r--r--gdb/python/py-frame.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index cf7cc27..c29d626 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -122,7 +122,7 @@ static PyObject *
frapy_name (PyObject *self, PyObject *args)
{
struct frame_info *frame;
- const char *name;
+ char *name = NULL;
enum language lang;
PyObject *result;
volatile struct gdb_exception except;
@@ -133,10 +133,17 @@ frapy_name (PyObject *self, PyObject *args)
find_frame_funname (frame, &name, &lang, NULL);
}
+
+ if (except.reason < 0)
+ xfree (name);
+
GDB_PY_HANDLE_EXCEPTION (except);
if (name)
- result = PyUnicode_Decode (name, strlen (name), host_charset (), NULL);
+ {
+ result = PyUnicode_Decode (name, strlen (name), host_charset (), NULL);
+ xfree (name);
+ }
else
{
result = Py_None;