diff options
author | xujing <xujing125@huawei.com> | 2022-11-25 17:04:11 +0800 |
---|---|---|
committer | Michal Domonkos <mdomonko@redhat.com> | 2023-03-13 15:32:25 +0100 |
commit | 32adbfffc63af1941ade9c734e4c8775d483dd14 (patch) | |
tree | 79b657a97d427c6e0355cf91eb49a74bb4692546 | |
parent | 0be727e66dbec5f03dd6c2045acb1558fefb8b76 (diff) | |
download | rpm-32adbfffc63af1941ade9c734e4c8775d483dd14.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.
(cherry picked from commit c013821c0c9350b67d9f9a02848e1a7f87fa180b)
-rw-r--r-- | build/parseScript.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/build/parseScript.c b/build/parseScript.c index 95a9fc590..c2dd6136d 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[] = { @@ -462,6 +463,8 @@ exit: free(reqargs); freeStringBuf(sb); free(progArgv); + if (origprog != prog) + free(origprog); free(prog); free(name); free(file); |