]> git.ipfire.org Git - thirdparty/git.git/commit
worktree: fix leak in check_clean_worktree()
authorJeff King <peff@peff.net>
Thu, 27 Aug 2020 05:25:04 +0000 (01:25 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Aug 2020 15:30:17 +0000 (08:30 -0700)
commit27ed6ccc12a331a1e6014f2fe101a2c551167e9e
tree6542ae3eb9f193a729b512cf24f04303c2da7fb9
parent47ae905ffb98cc4d4fd90083da6bc8dab55d9ecc
worktree: fix leak in check_clean_worktree()

We allocate a child_env strvec but never free its memory. Instead, let's
just use the strvec that our child_process struct provides, which is
cleaned up automatically when we run the command.

And while we're moving the initialization of the child_process around,
let's switch it to use the official init function (zero-initializing it
works OK, since strvec is happy enough with that, but it sets a bad
example).

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/worktree.c