fix py-frame.c
[deliverable/binutils-gdb.git] / gdb / python / py-frame.c
index c29d626cbdf84fd73628110d94fa6065750c2594..2615ddf75fb14a8b7fe599b59f53ca14f9e6ff64 100644 (file)
@@ -461,6 +461,7 @@ frapy_read_var (PyObject *self, PyObject *args)
            {
              PyErr_SetString (PyExc_RuntimeError,
                               _("Second argument must be block."));
+             do_cleanups (cleanup);
              return NULL;
            }
        }
@@ -473,7 +474,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)
        {
This page took 0.023585 seconds and 4 git commands to generate.