[PATCH 19/40] fix py-frame.c

Tom Tromey
2013-05-09T18:51:42Z

A couple return paths in frapy_read_var were missing do_cleanups calls.

* python/py-frame.c (frapy_read_var): Call do_cleanups along
all return paths.
---
gdb/python/py-frame.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index e2eb9c5..33d0bd0 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -456,6 +456,7 @@ frapy_read_var (PyObject *self, PyObject *args)
{
PyErr_SetString (PyExc_RuntimeError,
_("Second argument must be block."));
+ do_cleanups (cleanup);
return NULL;
}
}
@@ -468,7 +469,11 @@ frapy_read_var (PyObject *self, PyObject *args)
block = get_frame_block (frame, NULL);
var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ if (except.reason < 0)
+ {
+ do_cleanups (cleanup);
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }

if (!var)
{
--
1.8.1.4