This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 16/28] reference count in bpfinishpy_out_of_scope


The checker noticed a missing decref in bpfinishpy_out_of_scope.

	* python/py-finishbreakpoint.c (bpfinishpy_out_of_scope):
	Decref the reslut of PyObject_CallMethod.
---
 gdb/python/py-finishbreakpoint.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index b52bd7e..f65e026 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -326,8 +326,12 @@ bpfinishpy_out_of_scope (struct finish_breakpoint_object *bpfinish_obj)
   if (bpfinish_obj->py_bp.bp->enable_state == bp_enabled
       && PyObject_HasAttrString (py_obj, outofscope_func))
     {
-      if (!PyObject_CallMethod (py_obj, outofscope_func, NULL))
-          gdbpy_print_stack ();
+      PyObject *meth_result;
+
+      meth_result = PyObject_CallMethod (py_obj, outofscope_func, NULL);
+      if (meth_result == NULL)
+	gdbpy_print_stack ();
+      Py_XDECREF (meth_result);
     }
 
   delete_breakpoint (bpfinish_obj->py_bp.bp);
-- 
1.8.1.4



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]