From: Doug Evans Date: Tue, 9 Dec 2014 02:27:41 +0000 (-0800) Subject: python/py-objfile.c (objfpy_get_owner): Increment refcount of result. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d4d1e336f94fe40283d6c27b79723fd4bac3ed13;p=binutils-gdb.git python/py-objfile.c (objfpy_get_owner): Increment refcount of result. gdb/ChangeLog: * python/py-objfile.c (objfpy_get_owner): Increment refcount of result. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8e4be257a8a..ad845a75279 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +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. diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c index 51cf47cfffd..d90928bb300 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; }