diff options
author | xujing <xujing125@huawei.com> | 2022-11-24 17:16:46 +0800 |
---|---|---|
committer | Michal Domonkos <mdomonko@redhat.com> | 2023-03-13 15:32:25 +0100 |
commit | 1527b05c142bef89614df1d5176b94b29e2bae76 (patch) | |
tree | f26593fda8c809cb8a34fd20639e255b5bc9e9e6 | |
parent | 7489ee80bfc9f298ae3070b09d7e124ff0e979f8 (diff) | |
download | rpm-1527b05c142bef89614df1d5176b94b29e2bae76.tar.gz |
Fix file leak when src rpm in URL format is used for installation
%{_tmppath}/rpm-tmp.* is created by rpmMkTempFile() when src rpm in
URL format is used for installation, which is leaked.
(cherry picked from commit 0b34438ccc3fdcbdaa6226d2398df88cc7439603)
-rw-r--r-- | lib/rpminstall.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/rpminstall.c b/lib/rpminstall.c index f1bc1c5d9..3a1b87d35 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -675,8 +675,12 @@ exit: } } if (eiu->sourceURL != NULL) { - for (i = 0; i < eiu->numSRPMS; i++) + for (i = 0; i < eiu->numSRPMS; i++) { + if (eiu->sourceURL[i] == NULL) continue; + if (eiu->pkgState[i] == 1) + (void) unlink(eiu->sourceURL[i]); eiu->sourceURL[i] = _free(eiu->sourceURL[i]); + } } eiu->pkgState = _free(eiu->pkgState); eiu->pkgURL = _free(eiu->pkgURL); |