diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-10-05 17:23:34 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-10-05 17:23:34 +0300 |
commit | 55e6a4b905c1cf680a1235085e268b04e1b5405a (patch) | |
tree | 81bf34977f2cb28d341b34a4505578a54f340d75 | |
parent | 3d1169fe698910fc62dd1893c861963dedea2945 (diff) | |
download | rpm-55e6a4b905c1cf680a1235085e268b04e1b5405a.tar.gz rpm-55e6a4b905c1cf680a1235085e268b04e1b5405a.tar.bz2 rpm-55e6a4b905c1cf680a1235085e268b04e1b5405a.zip |
Dont leak memory from rpm.fi() methods
- Py_BuildValue() always copies the data mallocing here is just wrong
-rw-r--r-- | python/rpmfi-py.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c index 6d034dbd7..6f0e162ff 100644 --- a/python/rpmfi-py.c +++ b/python/rpmfi-py.c @@ -42,19 +42,19 @@ rpmfi_DX(rpmfiObject * s) static PyObject * rpmfi_BN(rpmfiObject * s) { - return Py_BuildValue("s", xstrdup(rpmfiBN(s->fi))); + return Py_BuildValue("s", rpmfiBN(s->fi)); } static PyObject * rpmfi_DN(rpmfiObject * s) { - return Py_BuildValue("s", xstrdup(rpmfiDN(s->fi))); + return Py_BuildValue("s", rpmfiDN(s->fi)); } static PyObject * rpmfi_FN(rpmfiObject * s) { - return Py_BuildValue("s", xstrdup(rpmfiFN(s->fi))); + return Py_BuildValue("s", rpmfiFN(s->fi)); } static PyObject * @@ -98,7 +98,7 @@ rpmfi_Digest(rpmfiObject * s) static PyObject * rpmfi_FLink(rpmfiObject * s) { - return Py_BuildValue("s", xstrdup(rpmfiFLink(s->fi))); + return Py_BuildValue("s", rpmfiFLink(s->fi)); } static PyObject * @@ -122,13 +122,13 @@ rpmfi_FMtime(rpmfiObject * s) static PyObject * rpmfi_FUser(rpmfiObject * s) { - return Py_BuildValue("s", xstrdup(rpmfiFUser(s->fi))); + return Py_BuildValue("s", rpmfiFUser(s->fi)); } static PyObject * rpmfi_FGroup(rpmfiObject * s) { - return Py_BuildValue("s", xstrdup(rpmfiFGroup(s->fi))); + return Py_BuildValue("s", rpmfiFGroup(s->fi)); } static PyObject * @@ -144,7 +144,7 @@ rpmfi_FClass(rpmfiObject * s) if ((FClass = rpmfiFClass(s->fi)) == NULL) FClass = ""; - return Py_BuildValue("s", xstrdup(FClass)); + return Py_BuildValue("s", FClass); } static PyObject * @@ -279,7 +279,7 @@ rpmfi_subscript(rpmfiObject * s, PyObject * key) ix = (int) PyInt_AsLong(key); rpmfiSetFX(s->fi, ix); - return Py_BuildValue("s", xstrdup(rpmfiFN(s->fi))); + return Py_BuildValue("s", rpmfiFN(s->fi)); } static PyMappingMethods rpmfi_as_mapping = { |