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 74d4731da1f (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>

Ævar Arnfjörð Bjarmason committed Sep 1, 2022 at 01:14 UTC 17af0a8444523f4df98e21165a3e476f05749237
1 file changed +1
builtin/submodule--helper.c
+1
index 3453faabd3..79ffcb5090 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2397,6 +2397,7 @@ static int ensure_core_worktree(const char *path) strbuf_release(&sb); } + repo_clear(&subrepo); return 0; }