public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: - fix a bunch of python refcount-errors causing major memory leaks
Date: Mon, 23 Nov 2026 09:26:17 GMT [thread overview]
Message-ID: <179542597791.1.12104500678995604173.rpms-rpm-36fffc974de0@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/rpm
Branch : pmatilai-v6
Commit : 36fffc974de05d92b407a7c80a01f519deb0aeef
Author : Panu Matilainen <pmatilai@fedoraproject.org>
Date : 2009-12-09T13:16:52+00:00
Stats : +76/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpm/c/36fffc974de05d92b407a7c80a01f519deb0aeef?branch=pmatilai-v6
Log:
- fix a bunch of python refcount-errors causing major memory leaks
---
diff --git a/rpm-4.7.90-python-refcounts.patch b/rpm-4.7.90-python-refcounts.patch
new file mode 100644
index 0000000..d01b573
--- /dev/null
+++ b/rpm-4.7.90-python-refcounts.patch
@@ -0,0 +1,70 @@
+diff --git a/python/header-py.c b/python/header-py.c
+index 0416058..539db0d 100644
+--- a/python/header-py.c
++++ b/python/header-py.c
+@@ -139,7 +139,9 @@ static PyObject * hdrKeyList(hdrObject * s)
+ rpmTag tag;
+
+ while ((tag = headerNextTag(hi)) != RPMTAG_NOT_FOUND) {
+- PyList_Append(keys, PyInt_FromLong(tag));
++ PyObject *to = PyInt_FromLong(tag);
++ PyList_Append(keys, to);
++ Py_DECREF(to);
+ }
+ headerFreeIterator(hi);
+
+diff --git a/python/rpmtd-py.c b/python/rpmtd-py.c
+index eef35fe..1ba3a3d 100644
+--- a/python/rpmtd-py.c
++++ b/python/rpmtd-py.c
+@@ -46,7 +46,9 @@ PyObject *rpmtd_AsPyobj(rpmtd td)
+ if (array) {
+ res = PyList_New(0);
+ while (rpmtdNext(td) >= 0) {
+- PyList_Append(res, rpmtd_ItemAsPyobj(td, class));
++ PyObject *item = rpmtd_ItemAsPyobj(td, class);
++ PyList_Append(res, item);
++ Py_DECREF(item);
+ }
+ } else {
+ res = rpmtd_ItemAsPyobj(td, class);
+diff --git a/python/rpmts-py.c b/python/rpmts-py.c
+index f774818..745b526 100644
+--- a/python/rpmts-py.c
++++ b/python/rpmts-py.c
+@@ -351,6 +351,7 @@ rpmts_HdrFromFdno(rpmtsObject * s, PyObject *arg)
+
+ if (rpmrc == RPMRC_OK) {
+ ho = hdr_Wrap(&hdr_Type, h);
++ h = headerFree(h); /* ref held by python object */
+ } else {
+ Py_INCREF(Py_None);
+ ho = Py_None;
+@@ -518,6 +519,7 @@ rpmts_Problems(rpmtsObject * s)
+ while (rpmpsNextIterator(psi) >= 0) {
+ PyObject *prob = rpmprob_Wrap(&rpmProblem_Type, rpmpsGetProblem(psi));
+ PyList_Append(problems, prob);
++ Py_DECREF(prob);
+ }
+ rpmpsFreeIterator(psi);
+ rpmpsFree(ps);
+diff --git a/python/spec-py.c b/python/spec-py.c
+index e162bb3..f5a4b33 100644
+--- a/python/spec-py.c
++++ b/python/spec-py.c
+@@ -177,6 +177,7 @@ static PyObject * spec_get_sources(specObject *s, void *closure)
+ PyObject *srcUrl = Py_BuildValue("(sii)", source->fullSource,
+ source->num, source->flags);
+ PyList_Append(sourceList, srcUrl);
++ Py_DECREF(srcUrl);
+ }
+
+ return sourceList;
+@@ -192,6 +193,7 @@ static PyObject * spec_get_packages(specObject *s, void *closure)
+ for (pkg = spec->packages; pkg; pkg = pkg->next) {
+ PyObject *po = specPkg_Wrap(&specPkg_Type, pkg);
+ PyList_Append(pkgList, po);
++ Py_DECREF(po);
+ }
+ return pkgList;
+ }
diff --git a/rpm.spec b/rpm.spec
index e52386e..b20313a 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -21,7 +21,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
-Release: 0.%{snapver}.2
+Release: 0.%{snapver}.3
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@@ -38,6 +38,7 @@ Patch3: rpm-4.7.90-fedora-specspo.patch
# Patches already in upstream
Patch200: rpm-4.7.90-python-bytecompile.patch
+Patch201: rpm-4.7.90-python-refcounts.patch
# These are not yet upstream
Patch301: rpm-4.6.0-niagara.patch
@@ -183,6 +184,7 @@ packages on a system.
%patch3 -p1 -b .fedora-specspo
%patch200 -p1 -b .python-bytecompile
+%patch201 -p1 -b .python-refcounts
%patch301 -p1 -b .niagara
%patch302 -p1 -b .geode
@@ -397,6 +399,9 @@ exit 0
%doc doc/librpm/html/*
%changelog
+* Wed Dec 09 2009 Panu Matilainen <pmatilai@redhat.com> - 4.8.0-0.beta1.3
+- fix a bunch of python refcount-errors causing major memory leaks
+
* Mon Dec 07 2009 Panu Matilainen <pmatilai@redhat.com> - 4.8.0-0.beta1.2
- fix noise from python bytecompile on non-python packages (#539635)
- make all our -devel [build]requires isa-specific
reply other threads:[~2026-11-23 9:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179542597791.1.12104500678995604173.rpms-rpm-36fffc974de0@fedoraproject.org \
--to=pmatilai@fedoraproject.org \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox