revision: fix leaking bloom filters

The memory allocated by `prepare_to_use_bloom_filter()` is not released
by `release_revisions()`, causing a memory leak. Plug it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt 2024-11-05 07:16:58 +01:00 committed by Junio C Hamano
parent 43fedde3df
commit e29ff075e0
2 changed files with 6 additions and 0 deletions

View File

@ -3227,6 +3227,11 @@ void release_revisions(struct rev_info *revs)
clear_decoration(&revs->treesame, free);
line_log_free(revs);
oidset_clear(&revs->missing_commits);
for (int i = 0; i < revs->bloom_keys_nr; i++)
clear_bloom_key(&revs->bloom_keys[i]);
FREE_AND_NULL(revs->bloom_keys);
revs->bloom_keys_nr = 0;
}
static void add_child(struct rev_info *revs, struct commit *parent, struct commit *child)

View File

@ -4,6 +4,7 @@ test_description='git log for a path with Bloom filters'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-chunk.sh