|
Panu Matilainen |
36fffc |
diff --git a/python/header-py.c b/python/header-py.c
|
|
Panu Matilainen |
36fffc |
index 0416058..539db0d 100644
|
|
Panu Matilainen |
36fffc |
--- a/python/header-py.c
|
|
Panu Matilainen |
36fffc |
+++ b/python/header-py.c
|
|
Panu Matilainen |
36fffc |
@@ -139,7 +139,9 @@ static PyObject * hdrKeyList(hdrObject * s)
|
|
Panu Matilainen |
36fffc |
rpmTag tag;
|
|
Panu Matilainen |
36fffc |
|
|
Panu Matilainen |
36fffc |
while ((tag = headerNextTag(hi)) != RPMTAG_NOT_FOUND) {
|
|
Panu Matilainen |
36fffc |
- PyList_Append(keys, PyInt_FromLong(tag));
|
|
Panu Matilainen |
36fffc |
+ PyObject *to = PyInt_FromLong(tag);
|
|
Panu Matilainen |
36fffc |
+ PyList_Append(keys, to);
|
|
Panu Matilainen |
36fffc |
+ Py_DECREF(to);
|
|
Panu Matilainen |
36fffc |
}
|
|
Panu Matilainen |
36fffc |
headerFreeIterator(hi);
|
|
Panu Matilainen |
36fffc |
|
|
Panu Matilainen |
36fffc |
diff --git a/python/rpmtd-py.c b/python/rpmtd-py.c
|
|
Panu Matilainen |
36fffc |
index eef35fe..1ba3a3d 100644
|
|
Panu Matilainen |
36fffc |
--- a/python/rpmtd-py.c
|
|
Panu Matilainen |
36fffc |
+++ b/python/rpmtd-py.c
|
|
Panu Matilainen |
36fffc |
@@ -46,7 +46,9 @@ PyObject *rpmtd_AsPyobj(rpmtd td)
|
|
Panu Matilainen |
36fffc |
if (array) {
|
|
Panu Matilainen |
36fffc |
res = PyList_New(0);
|
|
Panu Matilainen |
36fffc |
while (rpmtdNext(td) >= 0) {
|
|
Panu Matilainen |
36fffc |
- PyList_Append(res, rpmtd_ItemAsPyobj(td, class));
|
|
Panu Matilainen |
36fffc |
+ PyObject *item = rpmtd_ItemAsPyobj(td, class);
|
|
Panu Matilainen |
36fffc |
+ PyList_Append(res, item);
|
|
Panu Matilainen |
36fffc |
+ Py_DECREF(item);
|
|
Panu Matilainen |
36fffc |
}
|
|
Panu Matilainen |
36fffc |
} else {
|
|
Panu Matilainen |
36fffc |
res = rpmtd_ItemAsPyobj(td, class);
|
|
Panu Matilainen |
36fffc |
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
|
|
Panu Matilainen |
36fffc |
index f774818..745b526 100644
|
|
Panu Matilainen |
36fffc |
--- a/python/rpmts-py.c
|
|
Panu Matilainen |
36fffc |
+++ b/python/rpmts-py.c
|
|
Panu Matilainen |
36fffc |
@@ -351,6 +351,7 @@ rpmts_HdrFromFdno(rpmtsObject * s, PyObject *arg)
|
|
Panu Matilainen |
36fffc |
|
|
Panu Matilainen |
36fffc |
if (rpmrc == RPMRC_OK) {
|
|
Panu Matilainen |
36fffc |
ho = hdr_Wrap(&hdr_Type, h);
|
|
Panu Matilainen |
36fffc |
+ h = headerFree(h); /* ref held by python object */
|
|
Panu Matilainen |
36fffc |
} else {
|
|
Panu Matilainen |
36fffc |
Py_INCREF(Py_None);
|
|
Panu Matilainen |
36fffc |
ho = Py_None;
|
|
Panu Matilainen |
36fffc |
@@ -518,6 +519,7 @@ rpmts_Problems(rpmtsObject * s)
|
|
Panu Matilainen |
36fffc |
while (rpmpsNextIterator(psi) >= 0) {
|
|
Panu Matilainen |
36fffc |
PyObject *prob = rpmprob_Wrap(&rpmProblem_Type, rpmpsGetProblem(psi));
|
|
Panu Matilainen |
36fffc |
PyList_Append(problems, prob);
|
|
Panu Matilainen |
36fffc |
+ Py_DECREF(prob);
|
|
Panu Matilainen |
36fffc |
}
|
|
Panu Matilainen |
36fffc |
rpmpsFreeIterator(psi);
|
|
Panu Matilainen |
36fffc |
rpmpsFree(ps);
|
|
Panu Matilainen |
36fffc |
diff --git a/python/spec-py.c b/python/spec-py.c
|
|
Panu Matilainen |
36fffc |
index e162bb3..f5a4b33 100644
|
|
Panu Matilainen |
36fffc |
--- a/python/spec-py.c
|
|
Panu Matilainen |
36fffc |
+++ b/python/spec-py.c
|
|
Panu Matilainen |
36fffc |
@@ -177,6 +177,7 @@ static PyObject * spec_get_sources(specObject *s, void *closure)
|
|
Panu Matilainen |
36fffc |
PyObject *srcUrl = Py_BuildValue("(sii)", source->fullSource,
|
|
Panu Matilainen |
36fffc |
source->num, source->flags);
|
|
Panu Matilainen |
36fffc |
PyList_Append(sourceList, srcUrl);
|
|
Panu Matilainen |
36fffc |
+ Py_DECREF(srcUrl);
|
|
Panu Matilainen |
36fffc |
}
|
|
Panu Matilainen |
36fffc |
|
|
Panu Matilainen |
36fffc |
return sourceList;
|
|
Panu Matilainen |
36fffc |
@@ -192,6 +193,7 @@ static PyObject * spec_get_packages(specObject *s, void *closure)
|
|
Panu Matilainen |
36fffc |
for (pkg = spec->packages; pkg; pkg = pkg->next) {
|
|
Panu Matilainen |
36fffc |
PyObject *po = specPkg_Wrap(&specPkg_Type, pkg);
|
|
Panu Matilainen |
36fffc |
PyList_Append(pkgList, po);
|
|
Panu Matilainen |
36fffc |
+ Py_DECREF(po);
|
|
Panu Matilainen |
36fffc |
}
|
|
Panu Matilainen |
36fffc |
return pkgList;
|
|
Panu Matilainen |
36fffc |
}
|