public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: Fix a largish directory walk related memory leak in transactions
Date: Mon, 23 Nov 2026 09:34:28 GMT [thread overview]
Message-ID: <179542646840.1.4733250635674256185.rpms-rpm-293b446a5102@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/rpm
Branch : pmatilai-v6
Commit : 293b446a510258a9fe9fbb266d460a99195a01e8
Author : Panu Matilainen <pmatilai@redhat.com>
Date : 2022-09-14T13:22:39+03:00
Stats : +43/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpm/c/293b446a510258a9fe9fbb266d460a99195a01e8?branch=pmatilai-v6
Log:
Fix a largish directory walk related memory leak in transactions
---
diff --git a/0001-Fix-a-memory-leak-in-the-new-directory-dance-in-ensu.patch b/0001-Fix-a-memory-leak-in-the-new-directory-dance-in-ensu.patch
new file mode 100644
index 0000000..5541a04
--- /dev/null
+++ b/0001-Fix-a-memory-leak-in-the-new-directory-dance-in-ensu.patch
@@ -0,0 +1,38 @@
+From f78be76a00878183da86d5e37ddbe421c5fe028c Mon Sep 17 00:00:00 2001
+Message-Id: <f78be76a00878183da86d5e37ddbe421c5fe028c.1663150557.git.pmatilai@redhat.com>
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Wed, 14 Sep 2022 13:13:24 +0300
+Subject: [PATCH] Fix a memory leak in the new directory dance in ensureDir()
+
+This would leak the path whenever we already had the directory open.
+Which happens a lot. Oops.
+---
+ lib/fsm.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/lib/fsm.c b/lib/fsm.c
+index 129054067..7987abbc9 100644
+--- a/lib/fsm.c
++++ b/lib/fsm.c
+@@ -374,8 +374,6 @@ static int fsmDoMkDir(rpmPlugins plugins, int dirfd, const char *dn,
+ static int ensureDir(rpmPlugins plugins, const char *p, int owned, int create,
+ int quiet, int *dirfdp)
+ {
+- char *path = xstrdup(p);
+- char *dp = path;
+ char *sp = NULL, *bn;
+ char *apath = NULL;
+ int oflags = O_RDONLY;
+@@ -387,6 +385,9 @@ static int ensureDir(rpmPlugins plugins, const char *p, int owned, int create,
+ int dirfd = fsmOpenat(-1, "/", oflags, 1);
+ int fd = dirfd; /* special case of "/" */
+
++ char *path = xstrdup(p);
++ char *dp = path;
++
+ while ((bn = strtok_r(dp, "/", &sp)) != NULL) {
+ fd = fsmOpenat(dirfd, bn, oflags, 1);
+ /* assemble absolute path for plugins benefit, sigh */
+--
+2.37.3
+
diff --git a/rpm.spec b/rpm.spec
index bb0a908..cc80ba5 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -30,7 +30,7 @@
%global rpmver 4.18.0
%global snapver rc1
-%global baserelease 3
+%global baserelease 4
%global sover 9
%global srcver %{rpmver}%{?snapver:-%{snapver}}
@@ -57,6 +57,7 @@ Patch3: rpm-4.9.90-no-man-dirs.patch
# Patches already upstream:
Patch100: 0001-Fix-buffer-overrun-from-commit-4420c78beb86cc6739227.patch
+Patch101: 0001-Fix-a-memory-leak-in-the-new-directory-dance-in-ensu.patch
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@@ -611,6 +612,9 @@ fi
%doc docs/librpm/html/*
%changelog
+* Wed Sep 14 2022 Panu Matilainen <pmatilai@redhat.com> - 4.18.0-0.rc1.4
+- Fix a largish directory walk related memory leak in transactions
+
* Wed Sep 07 2022 Panu Matilainen <pmatilai@redhat.com> - 4.18.0-0.rc1.3
- Fix buffer overrun on rpmdb queries involving ^ in version
reply other threads:[~2026-11-23 9:34 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=179542646840.1.4733250635674256185.rpms-rpm-293b446a5102@fedoraproject.org \
--to=pmatilai@redhat.com \
--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