]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/worktree-check-clean-leakfix'
authorJunio C Hamano <gitster@pobox.com>
Wed, 9 Sep 2020 20:53:07 +0000 (13:53 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Sep 2020 20:53:07 +0000 (13:53 -0700)
Leakfix.

* jk/worktree-check-clean-leakfix:
  worktree: fix leak in check_clean_worktree()

1  2 
builtin/worktree.c

index 378f332b5d07edb55b48559ba328f980b84927e6,8bfb79f3a5febca79a81eb41c407b7e173c766ba..df214697d2a0a9d349797e961cdfd341dda35b44
@@@ -935,15 -934,14 +934,14 @@@ static void check_clean_worktree(struc
         */
        validate_no_submodules(wt);
  
-       strvec_pushf(&child_env, "%s=%s/.git",
+       child_process_init(&cp);
 -      argv_array_pushf(&cp.env_array, "%s=%s/.git",
 -                       GIT_DIR_ENVIRONMENT, wt->path);
 -      argv_array_pushf(&cp.env_array, "%s=%s",
 -                       GIT_WORK_TREE_ENVIRONMENT, wt->path);
 -      argv_array_pushl(&cp.args, "status",
 -                       "--porcelain", "--ignore-submodules=none",
 -                       NULL);
++      strvec_pushf(&cp.env_array, "%s=%s/.git",
 +                   GIT_DIR_ENVIRONMENT, wt->path);
-       strvec_pushf(&child_env, "%s=%s",
++      strvec_pushf(&cp.env_array, "%s=%s",
 +                   GIT_WORK_TREE_ENVIRONMENT, wt->path);
-       memset(&cp, 0, sizeof(cp));
 +      strvec_pushl(&cp.args, "status",
 +                   "--porcelain", "--ignore-submodules=none",
 +                   NULL);
-       cp.env = child_env.v;
        cp.git_cmd = 1;
        cp.dir = wt->path;
        cp.out = -1;