]> git.ipfire.org Git - thirdparty/git.git/commitdiff
bisect--helper: plug strvec leak
authorRené Scharfe <l.s.r@web.de>
Fri, 7 Oct 2022 15:08:42 +0000 (17:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 7 Oct 2022 17:21:18 +0000 (10:21 -0700)
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>
builtin/bisect--helper.c

index 8a052c7111f97f02690a31e98ef4102961796800..e90ce49695001ef2fa360a35a7fbbb3a32c138ef 100644 (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_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 "
                                                 "<valid-branch>'."),