1 Star 0 Fork 76

gys/rpm

forked from src-openEuler/rpm 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-fileleak-when-urlGetFile-fails-in-rpmInstall.patch 829 Bytes
一键复制 编辑 原始数据 按行查看 历史
From af81c95114bc2c01f005f15f17646a5188b5855d Mon Sep 17 00:00:00 2001
From: xujing <xujing125@huawei.com>
Date: Mon, 28 Nov 2022 11:34:24 +0800
Subject: [PATCH 3/3] Fix fileleak when urlGetFile fails in rpmInstall
The "tfn" is created by calling rpmMkTempFile but not unlinked when
urlGetFile fails in rpmInstall. Fix it.
---
lib/rpminstall.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index 90474fabf..c89ca30b5 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -520,7 +520,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;
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gys66/rpm.git
git@gitee.com:gys66/rpm.git
gys66
rpm
rpm
master

搜索帮助