public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED PATCH] (objfpy_get_owner): Increment refcount of result.
@ 2014-12-09  2:30 Doug Evans
  0 siblings, 0 replies; only message in thread
From: Doug Evans @ 2014-12-09  2:30 UTC (permalink / raw)
  To: gdb-patches

Hi.

I noticed this while debugging another objfile refcount problem
(in a new patch I'm working on).

2014-12-08  Doug Evans  <dje@google.com>

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

diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index 51cf47c..e78ceba 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -93,9 +94,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;
 }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-09  2:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-09  2:30 [COMMITTED PATCH] (objfpy_get_owner): Increment refcount of result Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).