From: Junio C Hamano Date: Wed, 9 Sep 2020 20:53:07 +0000 (-0700) Subject: Merge branch 'jk/worktree-check-clean-leakfix' X-Git-Tag: v2.29.0-rc0~89 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1aadb47aad7f4648a1de1e2de84cbcf235eeff59;p=thirdparty%2Fgit.git Merge branch 'jk/worktree-check-clean-leakfix' Leakfix. * jk/worktree-check-clean-leakfix: worktree: fix leak in check_clean_worktree() --- 1aadb47aad7f4648a1de1e2de84cbcf235eeff59 diff --cc builtin/worktree.c index 378f332b5d,8bfb79f3a5..df214697d2 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@@ -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;