[python] [patch] PR python/13316
Phil Muldoon
pmuldoon@redhat.com
Mon Oct 24 12:54:00 GMT 2011
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);
More information about the Gdb-patches
mailing list