* python/py-event.c (evpy_emit_event): Decref the
authorTom Tromey <tromey@redhat.com>
Mon, 20 May 2013 20:23:19 +0000 (20:23 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 20 May 2013 20:23:19 +0000 (20:23 +0000)
result of PyObject_CallFunctionObjArgs.

gdb/ChangeLog
gdb/python/py-event.c

index 84ca5962e0b667c194345f8cb96f6fb9169b5781..319625ab1fcf215c75d18da35358c19822884ff9 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-20  Tom Tromey  <tromey@redhat.com>
+
+       * python/py-event.c (evpy_emit_event): Decref the
+       result of PyObject_CallFunctionObjArgs.
+
 2013-05-20  Tom Tromey  <tromey@redhat.com>
 
        * python/py-cmd.c (cmdpy_completer): Use iterator protocol.
index 2c18e2fae3ac35a72fc4b89b720b86afaeefbd5f..afd07feca509ebc19a356321fc97e9c742b5f8a6 100644 (file)
@@ -111,16 +111,23 @@ evpy_emit_event (PyObject *event,
   for (i = 0; i < PyList_Size (callback_list_copy); i++)
     {
       PyObject *func = PyList_GetItem (callback_list_copy, i);
+      PyObject *func_result;
 
       if (func == NULL)
        goto fail;
 
-      if (!PyObject_CallFunctionObjArgs (func, event, NULL))
+      func_result = PyObject_CallFunctionObjArgs (func, event, NULL);
+
+      if (func_result == NULL)
        {
          /* Print the trace here, but keep going -- we want to try to
             call all of the callbacks even if one is broken.  */
          gdbpy_print_stack ();
        }
+      else
+       {
+         Py_DECREF (func_result);
+       }
     }
 
   Py_XDECREF (callback_list_copy);
This page took 0.027955 seconds and 4 git commands to generate.