aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r--gdb/python/python.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 29f83bb..b48cf05 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -206,6 +206,7 @@ get_parameter (PyObject *self, PyObject *args)
{
struct cmd_list_element *alias, *prefix, *cmd;
char *arg, *newarg;
+ int found = -1;
volatile struct gdb_exception except;
if (! PyArg_ParseTuple (args, "s", &arg))
@@ -215,15 +216,13 @@ get_parameter (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- if (! lookup_cmd_composition (newarg, &alias, &prefix, &cmd))
- {
- xfree (newarg);
- return PyErr_Format (PyExc_RuntimeError,
- "could not find variable `%s'", arg);
- }
+ found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
}
xfree (newarg);
GDB_PY_HANDLE_EXCEPTION (except);
+ if (!found)
+ return PyErr_Format (PyExc_RuntimeError,
+ "could not find parameter `%s'", arg);
if (! cmd->var)
return PyErr_Format (PyExc_RuntimeError, "`%s' is not a variable", arg);