python/py-objfile.c (objfpy_get_owner): Increment refcount of result.
authorDoug Evans <dje@google.com>
Tue, 9 Dec 2014 02:27:41 +0000 (18:27 -0800)
committerDoug Evans <dje@google.com>
Tue, 9 Dec 2014 02:27:41 +0000 (18:27 -0800)
gdb/ChangeLog:

* python/py-objfile.c (objfpy_get_owner): Increment refcount of result.

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

index 8e4be257a8a51a39e095852cc8f0c87ea0d25fc5..ad845a75279f394358c384273a4b5176808d9c91 100644 (file)
@@ -1,3 +1,7 @@
+2014-12-08  Doug Evans  <dje@google.com>
+
+       * python/py-objfile.c (objfpy_get_owner): Increment refcount of result.
+
 2014-12-08  Doug Evans  <dje@google.com>
 
        * NEWS: Mention gdb.Objfile.owner.
index 51cf47cfffdb83cd373022e64f41c9b4e87279b4..d90928bb300b0da514868f37169f2d46a198c101 100644 (file)
@@ -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;
 }