From 246526d019e0edf2ad804a182cae865ff5717cf7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ren=C3=A9=20Scharfe?= Date: Fri, 7 Oct 2022 17:08:42 +0200 Subject: [PATCH] bisect--helper: plug strvec leak MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: René Scharfe Signed-off-by: Junio C Hamano --- builtin/bisect--helper.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 8a052c7111..e90ce49695 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -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_trim(&start_head); if (!no_checkout) { - struct strvec argv = STRVEC_INIT; + const char *argv[] = { "checkout", start_head.buf, + "--", NULL }; - strvec_pushl(&argv, "checkout", start_head.buf, - "--", NULL); - if (run_command_v_opt(argv.v, RUN_GIT_CMD)) { + if (run_command_v_opt(argv, RUN_GIT_CMD)) { res = error(_("checking out '%s' failed." " Try 'git bisect start " "'."), -- 2.11.4.GIT