diff options
author | David Malcolm <dmalcolm@redhat.com> | 2011-12-15 22:22:56 -0500 |
---|---|---|
committer | Ales Kozumplik <akozumpl@redhat.com> | 2011-12-21 08:45:52 +0100 |
commit | 59807943af5c10c892b239f11b8fafb209254a4a (patch) | |
tree | f32d8f33d7db8d7d165b36235f152539dc373f8f /python/rpmfd-py.c | |
parent | ead20c495c52bacfb5fd7fd796bee0fb56981c52 (diff) | |
download | librpm-tizen-59807943af5c10c892b239f11b8fafb209254a4a.tar.gz librpm-tizen-59807943af5c10c892b239f11b8fafb209254a4a.tar.bz2 librpm-tizen-59807943af5c10c892b239f11b8fafb209254a4a.zip |
fix memory leaks in invocations of PyObject_Call
- 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).
Signed-off-by: Ales Kozumplik <akozumpl@redhat.com>
Diffstat (limited to 'python/rpmfd-py.c')
-rw-r--r-- | python/rpmfd-py.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/python/rpmfd-py.c b/python/rpmfd-py.c index 89a70cd0e..1150aa1b2 100644 --- a/python/rpmfd-py.c +++ b/python/rpmfd-py.c @@ -23,8 +23,8 @@ int rpmfdFromPyObject(PyObject *obj, rpmfdObject **fdop) Py_INCREF(obj); fdo = (rpmfdObject *) obj; } else { - fdo = (rpmfdObject *) PyObject_Call((PyObject *)&rpmfd_Type, - Py_BuildValue("(O)", obj), NULL); + fdo = (rpmfdObject *) PyObject_CallFunctionObjArgs((PyObject *)&rpmfd_Type, + obj, NULL); } if (fdo == NULL) return 0; |