[Rpm-maint] [PATCH] fix memory leaks in invocations of PyObject_Call
Ales Kozumplik
akozumpl at redhat.com
Mon Dec 19 08:26:01 UTC 2011
On 12/16/2011 04:22 AM, David Malcolm wrote:
> Various functions in the Python bindings have expressions of the form:
>
> PyObject_Call(callable,
> Py_BuildValue(fmtstring, ...), NULL);
>
> This leaks memory for the case when Py_BuildValue succeeds (it returns
> a new reference, which is never freed; PyObject_Call doesn't steal the
> reference): the argument tuple and all of its components will not be
> freed (until the process exits).
>
> There's also a possible segfault for the case where Py_BuildValue fails:
> PyObject_Call will likely segfault with a NULL 2nd argument.
These look good, though we shouldn't probably push them without testing.
Ales
More information about the Rpm-maint
mailing list