[PATCH v2 12/24] submodule--helper: fix a leak with repo_clear()
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 19, 2022, 20:47 UTC
- Message-ID
- <patch-v2-12.24-303447bd4f5-20220719T204458Z-avarab@gmail.com>
- In-Reply-To
- <cover-v2-00.24-00000000000-20220719T204458Z-avarab@gmail.com>
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> --- builtin/submodule--helper.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index a95231b1698..339ba94e658 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2457,6 +2457,7 @@ static void ensure_core_worktree(const char *path) free(abs_path); strbuf_release(&sb); } + repo_clear(&subrepo); } static const char *submodule_update_type_to_label(enum submodule_update_type type)
-- 2.37.1.1062.g385eac7fccf