diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-07-02 19:00:56 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-07-02 19:00:56 +0300 |
commit | ef17f6bcfc564c6cb132e5e4013b971819ebe66c (patch) | |
tree | 8216ee04f1173ae9eb4da809c0ebf6436e59a127 /python | |
parent | 20ee2a2df04f4667609b1d98bd798692bd14ecf5 (diff) | |
download | librpm-tizen-ef17f6bcfc564c6cb132e5e4013b971819ebe66c.tar.gz librpm-tizen-ef17f6bcfc564c6cb132e5e4013b971819ebe66c.tar.bz2 librpm-tizen-ef17f6bcfc564c6cb132e5e4013b971819ebe66c.zip |
Don't leak memory on python expandMacro()
Diffstat (limited to 'python')
-rw-r--r-- | python/rpmmacro-py.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/python/rpmmacro-py.c b/python/rpmmacro-py.c index cc4965aa0..a056998d2 100644 --- a/python/rpmmacro-py.c +++ b/python/rpmmacro-py.c @@ -52,11 +52,15 @@ rpmmacro_DelMacro(PyObject * self, PyObject * args, PyObject * kwds) PyObject * rpmmacro_ExpandMacro(PyObject * self, PyObject * args, PyObject * kwds) { - char * macro; + char *macro, *str; + PyObject *res; if (!PyArg_ParseTuple(args, "s", ¯o)) return NULL; - return Py_BuildValue("s", rpmExpand(macro, NULL)); + str = rpmExpand(macro, NULL); + res = Py_BuildValue("s", str); + free(str); + return res; } |