43 lines
1.1 KiB
Diff
43 lines
1.1 KiB
Diff
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
|
|
|