bisect--helper: plug strvec leak

The strvec "argv" is used to build a command for run_command_v_opt(),
but never freed.  Use a constant string array instead, which doesn't
require any cleanup.

Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe 2022-10-07 17:08:42 +02:00 committed by Junio C Hamano
parent a0feb8611d
commit 246526d019

View File

@ -764,11 +764,10 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, const char **a
strbuf_read_file(&start_head, git_path_bisect_start(), 0); strbuf_read_file(&start_head, git_path_bisect_start(), 0);
strbuf_trim(&start_head); strbuf_trim(&start_head);
if (!no_checkout) { if (!no_checkout) {
struct strvec argv = STRVEC_INIT; const char *argv[] = { "checkout", start_head.buf,
"--", NULL };
strvec_pushl(&argv, "checkout", start_head.buf, if (run_command_v_opt(argv, RUN_GIT_CMD)) {
"--", NULL);
if (run_command_v_opt(argv.v, RUN_GIT_CMD)) {
res = error(_("checking out '%s' failed." res = error(_("checking out '%s' failed."
" Try 'git bisect start " " Try 'git bisect start "
"<valid-branch>'."), "<valid-branch>'."),