diff options
author | xujing <xujing125@huawei.com> | 2022-11-26 11:39:48 +0800 |
---|---|---|
committer | Michal Domonkos <mdomonko@redhat.com> | 2023-03-13 15:32:25 +0100 |
commit | 5542a1ede3bcb2c1bdadf121da5adc9f9ef1245c (patch) | |
tree | eca22a546f44067a00bd8284dffb52d057572442 | |
parent | fdb2e428544f5ca61dda552e0a09ca8a24e99083 (diff) | |
download | rpm-5542a1ede3bcb2c1bdadf121da5adc9f9ef1245c.tar.gz |
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.
(cherry picked from commit 6130bd31038ff17a03fcac6ec7e41ac744163dde)
-rw-r--r-- | build/build.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/build/build.c b/build/build.c index 44794477c..5ec10ed00 100644 --- a/build/build.c +++ b/build/build.c @@ -213,6 +213,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, buildSubdir)) { rpmlog(RPMLOG_ERR, _("Bad exit status from %s (%s)\n"), |