From: Tom Tromey Date: Mon, 20 May 2013 20:23:19 +0000 (+0000) Subject: * python/py-event.c (evpy_emit_event): Decref the X-Git-Tag: cygwin-1_7_19-release~163 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c127ec5867aa79e3dc9818b7203d84699a3a3ab7;p=external%2Fbinutils.git * python/py-event.c (evpy_emit_event): Decref the result of PyObject_CallFunctionObjArgs. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 84ca596..319625a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2013-05-20 Tom Tromey + * python/py-event.c (evpy_emit_event): Decref the + result of PyObject_CallFunctionObjArgs. + +2013-05-20 Tom Tromey + * python/py-cmd.c (cmdpy_completer): Use iterator protocol. Correctly decref. diff --git a/gdb/python/py-event.c b/gdb/python/py-event.c index 2c18e2f..afd07fe 100644 --- a/gdb/python/py-event.c +++ b/gdb/python/py-event.c @@ -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);