Skip to content

Commit 246526d

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a0feb86 commit 246526d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

builtin/bisect--helper.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -764,11 +764,10 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, const char **a
764764
strbuf_read_file(&start_head, git_path_bisect_start(), 0);
765765
strbuf_trim(&start_head);
766766
if (!no_checkout) {
767-
struct strvec argv = STRVEC_INIT;
767+
const char *argv[] = { "checkout", start_head.buf,
768+
"--", NULL };
768769

769-
strvec_pushl(&argv, "checkout", start_head.buf,
770-
"--", NULL);
771-
if (run_command_v_opt(argv.v, RUN_GIT_CMD)) {
770+
if (run_command_v_opt(argv, RUN_GIT_CMD)) {
772771
res = error(_("checking out '%s' failed."
773772
" Try 'git bisect start "
774773
"<valid-branch>'."),

0 commit comments

Comments
 (0)