Skip to content

Commit 9794633

Browse files
avargitster
authored andcommitted
test-tool bloom: fix memory leaks
Fix memory leaks introduced with these tests in f1294ea (bloom.c: introduce core Bloom filter constructs, 2020-03-30), as a result we can mark almost the entirety of t0095-bloom.sh as passing with SANITIZE=leak using "TEST_PASSES_SANITIZE_LEAK=true", there's still an unrelated memory leak in "git commit" in one of the tests, let's skip that one under SANITIZE_LEAK for now. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1caaa85 commit 9794633

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

t/helper/test-bloom.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ static void add_string_to_filter(const char *data, struct bloom_filter *filter)
1616
}
1717
printf("\n");
1818
add_key_to_filter(&key, filter, &settings);
19+
clear_bloom_key(&key);
1920
}
2021

2122
static void print_bloom_filter(struct bloom_filter *filter) {
@@ -80,6 +81,7 @@ int cmd__bloom(int argc, const char **argv)
8081
}
8182

8283
print_bloom_filter(&filter);
84+
free(filter.data);
8385
}
8486

8587
if (!strcmp(argv[1], "get_filter_for_commit")) {

t/t0095-bloom.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ test_expect_success 'compute bloom key for test string 2' '
6767
test_cmp expect actual
6868
'
6969

70-
test_expect_success 'get bloom filters for commit with no changes' '
70+
test_expect_success !SANITIZE_LEAK 'get bloom filters for commit with no changes' '
7171
git init &&
7272
git commit --allow-empty -m "c0" &&
7373
cat >expect <<-\EOF &&

0 commit comments

Comments
 (0)