From: Sven Strickroth <email@xxxxxxxxxx> `ref_store_release` does not free the ref_store allocated in `ref_store_init`. Signed-off-by: Sven Strickroth <email@xxxxxxxxxx> --- repository: prevent memory leak when releasing ref stores Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1758%2Fcsware%2Frepository-memory-leak-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1758/csware/repository-memory-leak-v1 Pull-Request: https://github.com/git/git/pull/1758 repository.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/repository.c b/repository.c index 9825a308993..46f1eadfe95 100644 --- a/repository.c +++ b/repository.c @@ -366,12 +366,16 @@ void repo_clear(struct repository *repo) FREE_AND_NULL(repo->remote_state); } - strmap_for_each_entry(&repo->submodule_ref_stores, &iter, e) + strmap_for_each_entry(&repo->submodule_ref_stores, &iter, e) { ref_store_release(e->value); + free(e->value); + } strmap_clear(&repo->submodule_ref_stores, 1); - strmap_for_each_entry(&repo->worktree_ref_stores, &iter, e) + strmap_for_each_entry(&repo->worktree_ref_stores, &iter, e) { ref_store_release(e->value); + free(e->value); + } strmap_clear(&repo->worktree_ref_stores, 1); repo_clear_path_cache(&repo->cached_paths); base-commit: e559c4bf1a306cf5814418d318cc0fea070da3c7 -- gitgitgadget