submodule--helper: fix a leak with repo_clear()

Call repo_clear() in ensure_core_worktree() to free the "struct
repository". Fixes a leak that's been here since
74d4731da1 (submodule--helper: replace connect-gitdir-workingtree by
ensure-core-worktree, 2018-08-13).

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>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2022-09-01 01:14:16 +02:00 committed by Junio C Hamano
parent 980416e469
commit 17af0a8444

View File

@ -2397,6 +2397,7 @@ static int ensure_core_worktree(const char *path)
strbuf_release(&sb);
}
repo_clear(&subrepo);
return 0;
}