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]

RFC: another Python refcounting fix


I had a couple more refcounting fixes on my Python checker branch.

Here's the first one.  finish_python_initialization does not decref
'pythondir' along all the exit paths.

Built and regtested on x86-64 Fedora 18.

Tom

	* python/python.c (finish_python_initialization): Decref
	'pythondir' on failure path as well.
---
 gdb/python/python.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 690534f..e5705a8 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1770,10 +1770,9 @@ finish_python_initialization (void)
 	goto fail;
 
       err = PyList_Insert (sys_path, 0, pythondir);
+      Py_DECREF (pythondir);
       if (err)
 	goto fail;
-
-      Py_DECREF (pythondir);
     }
   else
     goto fail;
-- 
1.8.1.4


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