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]

[python] [patch] PR python/13316


This patch (found by David Malcolm's GCC plug-in Python reference
check), fixes a case where we do not decrement a value in two branches
of py-param.c:compute_enum_values.

OK?

Cheers,

Phil

--

2011-10-24  Phil Muldoon  <pmuldoon@redhat.com>

        PR python/13316

	* python/py-param.c (compute_enum_values): Decrement decrement
	PyObjects on function exit.
--


Index: python/py-param.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-param.c,v
retrieving revision 1.14
diff -u -r1.14 py-param.c
--- python/py-param.c	24 Oct 2011 11:39:50 -0000	1.14
+++ python/py-param.c	24 Oct 2011 12:28:52 -0000
@@ -605,9 +605,12 @@
 	  do_cleanups (back_to);
 	  PyErr_SetString (PyExc_RuntimeError, 
 			   _("The enumeration item not a string."));
+	  Py_DECREF (item);
 	  return 0;
 	}
       self->enumeration[i] = python_string_to_host_string (item);
+      Py_DECREF (item);
+
       if (self->enumeration[i] == NULL)
 	{
 	  do_cleanups (back_to);


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