* [python] [patch] PR python/13310
@ 2011-10-20 14:28 Phil Muldoon
2011-10-20 14:47 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Phil Muldoon @ 2011-10-20 14:28 UTC (permalink / raw)
To: gdb-patches
David Malcolm's GCC plug-in found another bug where we lose a reference.
The first case is we do not decrement "result" after a call to
"python_string_to_host_string". That function returns a xstrdup of the
string PyObject contents, and so "result" does not need to be preserved.
The second case is where we type-check the object, and if it is not a
Python string we set an exception without decrementing "result".
OK?
Cheers,
Phil
--
2011-10-20 Phil Muldoon <pmuldoon@redhat.com>
PR python/13310
* python/py-param.c (call_doc_function): Correctly deference on
function exit.
--
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index d68d8fb..fe31cd1 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -331,6 +331,7 @@ call_doc_function (PyObject *obj, PyObject *method, PyObject *arg)
if (gdbpy_is_string (result))
{
data = python_string_to_host_string (result);
+ Py_DECREF (result);
if (! data)
return NULL;
}
@@ -338,6 +339,7 @@ call_doc_function (PyObject *obj, PyObject *method, PyObject *arg)
{
PyErr_SetString (PyExc_RuntimeError,
_("Parameter must return a string value."));
+ Py_DECREF (result);
return NULL;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [python] [patch] PR python/13310
2011-10-20 14:28 [python] [patch] PR python/13310 Phil Muldoon
@ 2011-10-20 14:47 ` Tom Tromey
2011-10-24 11:52 ` Phil Muldoon
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2011-10-20 14:47 UTC (permalink / raw)
To: pmuldoon; +Cc: gdb-patches
>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
Phil> 2011-10-20 Phil Muldoon <pmuldoon@redhat.com>
Phil> PR python/13310
Phil> * python/py-param.c (call_doc_function): Correctly deference on
Phil> function exit.
Ok.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [python] [patch] PR python/13310
2011-10-20 14:47 ` Tom Tromey
@ 2011-10-24 11:52 ` Phil Muldoon
0 siblings, 0 replies; 3+ messages in thread
From: Phil Muldoon @ 2011-10-24 11:52 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
Tom Tromey <tromey@redhat.com> writes:
>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
>
> Phil> 2011-10-20 Phil Muldoon <pmuldoon@redhat.com>
> Phil> PR python/13310
>
> Phil> * python/py-param.c (call_doc_function): Correctly deference on
> Phil> function exit.
>
> Ok.
>
> Tom
So committed, thanks.
Cheers,
Phil
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-24 11:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-20 14:28 [python] [patch] PR python/13310 Phil Muldoon
2011-10-20 14:47 ` Tom Tromey
2011-10-24 11:52 ` Phil Muldoon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox