Skip to content

Commit e29ff07

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 43fedde commit e29ff07

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

revision.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3227,6 +3227,11 @@ void release_revisions(struct rev_info *revs)
32273227
clear_decoration(&revs->treesame, free);
32283228
line_log_free(revs);
32293229
oidset_clear(&revs->missing_commits);
3230+
3231+
for (int i = 0; i < revs->bloom_keys_nr; i++)
3232+
clear_bloom_key(&revs->bloom_keys[i]);
3233+
FREE_AND_NULL(revs->bloom_keys);
3234+
revs->bloom_keys_nr = 0;
32303235
}
32313236

32323237
static void add_child(struct rev_info *revs, struct commit *parent, struct commit *child)

t/t4216-log-bloom.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ test_description='git log for a path with Bloom filters'
44
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
55
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
66

7+
TEST_PASSES_SANITIZE_LEAK=true
78
. ./test-lib.sh
89
. "$TEST_DIRECTORY"/lib-chunk.sh
910

0 commit comments

Comments
 (0)