From d4d1e336f94fe40283d6c27b79723fd4bac3ed13 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Mon, 8 Dec 2014 18:27:41 -0800 Subject: [PATCH] python/py-objfile.c (objfpy_get_owner): Increment refcount of result. gdb/ChangeLog: * python/py-objfile.c (objfpy_get_owner): Increment refcount of result. --- gdb/ChangeLog | 4 ++++ gdb/python/py-objfile.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8e4be25..ad845a7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2014-12-08 Doug Evans + * python/py-objfile.c (objfpy_get_owner): Increment refcount of result. + +2014-12-08 Doug Evans + * NEWS: Mention gdb.Objfile.owner. * python/py-objfile.c (objfpy_get_owner): New function. (objfile_getset): Add "owner". diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c index 51cf47c..d90928b 100644 --- a/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c @@ -93,9 +93,13 @@ objfpy_get_owner (PyObject *self, void *closure) OBJFPY_REQUIRE_VALID (obj); owner = objfile->separate_debug_objfile_backlink; - if (owner != NULL) - return objfile_to_objfile_object (owner); + { + PyObject *result = objfile_to_objfile_object (owner); + + Py_XINCREF (result); + return result; + } Py_RETURN_NONE; } -- 2.7.4