aboutsummaryrefslogtreecommitdiffstats
path: root/commit-graph.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-09-01 01:14:19 +0200
committerJunio C Hamano <gitster@pobox.com>2022-09-02 09:18:13 -0700
commit4e83605d38e30ba56878c121443695cb7eef0f56 (patch)
treeda037b2826940fec580a5751ea6d1d5990364479 /commit-graph.c
parentsubmodule--helper: fix "reference" leak (diff)
downloadgit-4e83605d38e30ba56878c121443695cb7eef0f56.tar.gz
git-4e83605d38e30ba56878c121443695cb7eef0f56.zip
submodule--helper: fix obscure leak in module_add()
Fix an obscure leak in module_add(), if the "git add" command we were piping to failed we'd fail to strbuf_release(&sb). This fixes a leak introduced in a6226fd772b (submodule--helper: convert the bulk of cmd_add() to C, 2021-08-10). In fixing it move to a "goto cleanup" pattern, and since we need to introduce a "ret" variable to do that let's also get rid of the intermediate "exit_code" variable. The initialization to "-1" in a6226fd772b has always been redundant, we'd only use the "exit_code" value after assigning the return value of pipe_command() to it. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
0 files changed, 0 insertions, 0 deletions