summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxujing <xujing125@huawei.com>2022-11-24 10:43:11 +0800
committerMichal Domonkos <mdomonko@redhat.com>2023-03-13 15:32:25 +0100
commit3a13209d9ad0b15f667cb8eda97cdab45347ce09 (patch)
treee639c68077d3a4e26d8a7e3981cacb8ff399dde0
parent35d14c0e250a84536b14233fd37cc573ca46670f (diff)
downloadrpm-3a13209d9ad0b15f667cb8eda97cdab45347ce09.tar.gz
Fix header leak in rpmInstall()
When rpm installs a package, the header from tryReadHeader() in rpmInstall() is leaked in some cases. (cherry picked from commit 15a0c73f4698bc58fa2a633d46527c7813150f3a)
-rw-r--r--lib/rpminstall.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index e79f532eb..ee6c7dba9 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -563,13 +563,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",
@@ -594,6 +595,7 @@ restart:
rpmlog(RPMLOG_ERR, _("package %s is not relocatable\n"),
headerGetString(h, RPMTAG_NAME));
eiu->numFailed++;
+ headerFree(h);
goto exit;
}
}