public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpm] pmatilai-v6: Fix a largish directory walk related memory leak in transactions
@ 2026-11-23  9:34 Panu Matilainen
  0 siblings, 0 replies; only message in thread
From: Panu Matilainen @ 2026-11-23  9:34 UTC (permalink / raw)
  To: git-commits

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
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23  9:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23  9:34 [rpms/rpm] pmatilai-v6: Fix a largish directory walk related memory leak in transactions Panu Matilainen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox