2011-10-20 Phil Muldoon <pmuldoon@redhat.com>
authorPhil Muldoon <pmuldoon@redhat.com>
Thu, 20 Oct 2011 13:34:17 +0000 (13:34 +0000)
committerPhil Muldoon <pmuldoon@redhat.com>
Thu, 20 Oct 2011 13:34:17 +0000 (13:34 +0000)
        PR python/13308
        PR python/13309

* python/py-breakpoint.c (gdbpy_breakpoints): Fix List reference
leak.
* python/py-inferior.c (gdbpy_inferiors): Fix List reference
leak.  Delete unused variables.

gdb/ChangeLog
gdb/python/py-breakpoint.c
gdb/python/py-inferior.c

index 154aee51103864b3a2ac618d21e53adaaf14f9cb..c9d5b26bed86486d41d4749e4922ce70bd967288 100644 (file)
@@ -1,3 +1,13 @@
+2011-10-20  Phil Muldoon  <pmuldoon@redhat.com>
+
+        PR python/13308
+        PR python/13309
+
+       * python/py-breakpoint.c (gdbpy_breakpoints): Fix List reference
+       leak.
+       * python/py-inferior.c (gdbpy_inferiors): Fix List reference
+       leak.  Delete unused variables.
+
 2011-10-20  Phil Muldoon  <pmuldoon@redhat.com>
 
        PR python/12656
index 87265e269f300bb095d4e6fc05af22fd4823862c..daceb99d85e74625f398d65c79d49d190b231d23 100644 (file)
@@ -697,7 +697,7 @@ build_bp_list (struct breakpoint *b, void *arg)
 PyObject *
 gdbpy_breakpoints (PyObject *self, PyObject *args)
 {
-  PyObject *list;
+  PyObject *list, *tuple;
 
   if (bppy_live == 0)
     Py_RETURN_NONE;
@@ -715,7 +715,10 @@ gdbpy_breakpoints (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  return PyList_AsTuple (list);
+  tuple = PyList_AsTuple (list);
+  Py_DECREF (list);
+
+  return tuple;
 }
 
 /* Call the "stop" method (if implemented) in the breakpoint
index afc3eb0c995d22ce732bf39173cc7f19131d9e9c..d6086dc9dc1fce89c6a446d894ce36dec5ab2a9e 100644 (file)
@@ -377,9 +377,7 @@ build_inferior_list (struct inferior *inf, void *arg)
 PyObject *
 gdbpy_inferiors (PyObject *unused, PyObject *unused2)
 {
-  int i = 0;
-  PyObject *list, *inferior;
-  struct inferior *inf;
+  PyObject *list, *tuple;
 
   list = PyList_New (0);
   if (!list)
@@ -391,7 +389,10 @@ gdbpy_inferiors (PyObject *unused, PyObject *unused2)
       return NULL;
     }
 
-  return PyList_AsTuple (list);
+  tuple = PyList_AsTuple (list);
+  Py_DECREF (list);
+
+  return tuple;
 }
 
 /* Membuf and memory manipulation.  */