diff mbox series

[v7,09/17] submodule--helper: fix a leak with repo_clear()

Message ID patch-v7-09.17-71ebaac73c1-20220831T231003Z-avarab@gmail.com (mailing list archive)
State Accepted
Commit 17af0a8444523f4df98e21165a3e476f05749237
Headers show
Series submodule--helper: fix memory leaks | expand

Commit Message

Ævar Arnfjörð Bjarmason Aug. 31, 2022, 11:14 p.m. UTC
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 mbox series

Patch

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 162e92c033e..9a277057012 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2400,6 +2400,7 @@  static int ensure_core_worktree(const char *path)
 		strbuf_release(&sb);
 	}
 
+	repo_clear(&subrepo);
 	return 0;
 }