builtin/submodule--helper: clear child process when not running it
commit8f786a8e9fbbc8d110937a0ffdfe559f945aab50
authorPatrick Steinhardt <ps@pks.im>
Thu, 26 Sep 2024 11:46:11 +0000 (26 13:46 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 Sep 2024 15:25:34 +0000 (27 08:25 -0700)
treefd087b434b88c81e85929c74787b13a9b9a43e74
parent2e492f2047748cf70350d503214ef89f1110ee82
builtin/submodule--helper: clear child process when not running it

In `runcommand_in_submodule_cb()` we may end up not executing the child
command when `argv` is empty. But we still populate the command with
environment variables and other things, which needs cleanup. This leads
to a memory leak because we do not call `finish_command()`.

Fix this by clearing the child process when we don't execute it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c
t/t7407-submodule-foreach.sh