fix py-frame.c
authorTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 17:16:05 +0000 (17:16 +0000)
committerTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 17:16:05 +0000 (17:16 +0000)
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/ChangeLog
gdb/python/py-frame.c

index 2588d05ec468022b4fbf45bbed6806a26eb311a0..d5a5452ce2ac10ccd821de588a845c815dbd1c35 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-30  Tom Tromey  <tromey@redhat.com>
+
+       * python/py-frame.c (frapy_read_var): Call do_cleanups along
+       all return paths.
+
 2013-05-30  Tom Tromey  <tromey@redhat.com>
 
        * python/py-breakpoint.c (bppy_get_commands): Call do_cleanups
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)
        {