This is the mail archive of the archer@sourceware.org mailing list for the Archer 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]

[python] minor refcounting fix in pretty-printer


Today I happened to notice that in one error case we might skip a
deref.

Tom

2008-11-14  Tom Tromey  <tromey@redhat.com>

	* python/python.c (print_children): Don't "continue" past inner
	cleanup.

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 206b4aa..5ac8230 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -903,13 +903,14 @@ print_children (PyObject *printer, struct ui_file *stream, int format,
 
       if (! item)
 	break;
-      inner_cleanup = make_cleanup_py_decref (item);
 
       if (! PyArg_ParseTuple (item, "sO", &name, &py_v))
 	{
 	  gdbpy_print_stack ();
+	  Py_DECREF (item);
 	  continue;
 	}
+      inner_cleanup = make_cleanup_py_decref (item);
 
       if (i == 0)
 	fputs_filtered (" = {", stream);


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