summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxujing <xujing125@huawei.com>2022-11-28 11:34:24 +0800
committerMichal Domonkos <mdomonko@redhat.com>2023-03-13 15:32:25 +0100
commitfcd2ead5ead22ff04445ffb6ef8936b733b2e3f7 (patch)
tree57fef6e46ed9a43cb0db9f36ac84569778b17433
parentd336ec8303667b2edc361439aa1f4d7dc374b413 (diff)
downloadrpm-fcd2ead5ead22ff04445ffb6ef8936b733b2e3f7.tar.gz
Fix fileleak when urlGetFile fails in rpmInstall
The "tfn" is created by calling rpmMkTempFile but not unlinked when urlGetFile fails in rpmInstall. Fix it. (cherry picked from commit af81c95114bc2c01f005f15f17646a5188b5855d)
-rw-r--r--lib/rpminstall.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index 901964f8c..07ff603dd 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -522,7 +522,10 @@ restart:
_("skipping %s - transfer failed\n"), fileURL);
eiu->numFailed++;
eiu->pkgURL[eiu->pkgx] = NULL;
- tfn = _free(tfn);
+ if (tfn) {
+ (void) unlink(tfn);
+ tfn = _free(tfn);
+ }
break;
}
eiu->pkgState[eiu->pkgx] = 1;