summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorxujing <xujing125@huawei.com>2022-11-25 17:04:11 +0800
committerPanu Matilainen <pmatilai@redhat.com>2022-12-14 16:03:44 +0200
commitc013821c0c9350b67d9f9a02848e1a7f87fa180b (patch)
tree6ccb17598003a6bc9d8b9f4145d14199182f0246 /build
parent7fcdfd3b40f69af6a1d4980683859eef05f39b4e (diff)
downloadrpm-c013821c0c9350b67d9f9a02848e1a7f87fa180b.tar.gz
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.
Diffstat (limited to 'build')
-rw-r--r--build/parseScript.c3
1 files changed, 3 insertions, 0 deletions
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);