summaryrefslogtreecommitdiff
path: root/backport-Fix-sbp-leak-when-running-rpmbuild-with-quiet.patch
diff options
context:
space:
mode:
Diffstat (limited to 'backport-Fix-sbp-leak-when-running-rpmbuild-with-quiet.patch')
-rw-r--r--backport-Fix-sbp-leak-when-running-rpmbuild-with-quiet.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/backport-Fix-sbp-leak-when-running-rpmbuild-with-quiet.patch b/backport-Fix-sbp-leak-when-running-rpmbuild-with-quiet.patch
new file mode 100644
index 0000000..0c98b86
--- /dev/null
+++ b/backport-Fix-sbp-leak-when-running-rpmbuild-with-quiet.patch
@@ -0,0 +1,28 @@
+From 6130bd31038ff17a03fcac6ec7e41ac744163dde Mon Sep 17 00:00:00 2001
+From: xujing <xujing125@huawei.com>
+Date: Sat, 26 Nov 2022 11:39:48 +0800
+Subject: [PATCH 4/5] Fix *sbp leak when running rpmbuild with --quiet
+
+When running rpmbuild with --quiet, the "*sbp" may be alloced many
+times in buildSpec by calling doScript but only freed once. Fix it.
+---
+ build/build.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/build/build.c b/build/build.c
+index 9cd569b83..4437f6c9c 100644
+--- a/build/build.c
++++ b/build/build.c
+@@ -216,6 +216,9 @@ rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name,
+ buildCmd = rpmExpand(mCmd, " ", scriptName, NULL);
+ (void) poptParseArgvString(buildCmd, &argc, &argv);
+
++ if (sb_stdoutp && *sb_stdoutp)
++ *sb_stdoutp = freeStringBuf(*sb_stdoutp);
++
+ rpmlog(RPMLOG_NOTICE, _("Executing(%s): %s\n"), name, buildCmd);
+ if (rpmfcExec((ARGV_const_t)argv, NULL, sb_stdoutp, 1,
+ spec->buildSubdir)) {
+--
+2.27.0
+