summaryrefslogtreecommitdiff
path: root/backport-Fix-prog-leak-in-parseScript.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-09-10 03:05:12 +0000
committerCoprDistGit <infra@openeuler.org>2023-09-10 03:05:12 +0000
commit2bc2b430bc4c1a9a0bfd1c01da68bd53bf7da052 (patch)
treea2af4fd609c7decacbf0ea11926ea338596fb179 /backport-Fix-prog-leak-in-parseScript.patch
parent0ae9f87336a3d78d8fbc0a1e5c75cba5f9cf8597 (diff)
automatic import of rpm
Diffstat (limited to 'backport-Fix-prog-leak-in-parseScript.patch')
-rw-r--r--backport-Fix-prog-leak-in-parseScript.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/backport-Fix-prog-leak-in-parseScript.patch b/backport-Fix-prog-leak-in-parseScript.patch
new file mode 100644
index 0000000..fe0d786
--- /dev/null
+++ b/backport-Fix-prog-leak-in-parseScript.patch
@@ -0,0 +1,35 @@
+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
+