1 Star 0 Fork 76

gys/rpm

forked from src-openEuler/rpm 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-prog-leak-in-parseScript.patch 1015 Bytes
一键复制 编辑 原始数据 按行查看 历史
From c013821c0c9350b67d9f9a02848e1a7f87fa180b Mon Sep 17 00:00:00 2001
From: xujing <xujing125@huawei.com>
Date: Fri, 25 Nov 2022 17:04:11 +0800
Subject: [PATCH 2/5] Fix prog leak in parseScript
The "prog" will be alloced when using "-p" options, which cause src
"proc" leak. Add "origproc" to point to src "proc" to fix it.
---
build/parseScript.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/build/parseScript.c b/build/parseScript.c
index df7919238..f8b693ac6 100644
--- a/build/parseScript.c
+++ b/build/parseScript.c
@@ -102,6 +102,7 @@ int parseScript(rpmSpec spec, int parsePart)
poptContext optCon = NULL;
char *name = NULL;
char *prog = xstrdup("/bin/sh");
+ char *origprog = prog;
char *file = NULL;
int priority = 1000000;
struct poptOption optionsTable[] = {
@@ -482,6 +483,8 @@ exit:
free(reqargs);
freeStringBuf(sb);
free(progArgv);
+ if (origprog != prog)
+ free(origprog);
free(prog);
free(name);
free(file);
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gys66/rpm.git
git@gitee.com:gys66/rpm.git
gys66
rpm
rpm
master

搜索帮助