summaryrefslogtreecommitdiff
path: root/backport-Fix-header-leak-in-rpmInstall.patch
diff options
context:
space:
mode:
Diffstat (limited to 'backport-Fix-header-leak-in-rpmInstall.patch')
-rw-r--r--backport-Fix-header-leak-in-rpmInstall.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/backport-Fix-header-leak-in-rpmInstall.patch b/backport-Fix-header-leak-in-rpmInstall.patch
new file mode 100644
index 0000000..67dc581
--- /dev/null
+++ b/backport-Fix-header-leak-in-rpmInstall.patch
@@ -0,0 +1,42 @@
+From 15a0c73f4698bc58fa2a633d46527c7813150f3a Mon Sep 17 00:00:00 2001
+From: xujing <xujing125@huawei.com>
+Date: Thu, 24 Nov 2022 10:43:11 +0800
+Subject: [PATCH] Fix header leak in rpmInstall()
+
+When rpm installs a package, the header from tryReadHeader()
+in rpmInstall() is leaked in some cases.
+---
+ lib/rpminstall.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/lib/rpminstall.c b/lib/rpminstall.c
+index 9167dbdde..097599681 100644
+--- a/lib/rpminstall.c
++++ b/lib/rpminstall.c
+@@ -561,13 +561,14 @@ restart:
+ rc = tryReadManifest(eiu);
+ if (rc == RPMRC_OK) {
+ eiu->prevx++;
++ headerFree(h);
+ goto restart;
+ }
+ }
+
+ if (headerIsSource(h)) {
++ headerFree(h);
+ if (ia->installInterfaceFlags & INSTALL_FRESHEN) {
+- headerFree(h);
+ continue;
+ }
+ rpmlog(RPMLOG_DEBUG, "\tadded source package [%d]\n",
+@@ -592,6 +593,7 @@ restart:
+ rpmlog(RPMLOG_ERR, _("package %s is not relocatable\n"),
+ headerGetString(h, RPMTAG_NAME));
+ eiu->numFailed++;
++ headerFree(h);
+ goto exit;
+ }
+ }
+--
+2.33.0
+