[PATCH 1/4] test-bloom: stop setting up Git directory twice
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Nov 6, 2023, 10:45 UTC
- Message-ID
- <fb1cc73ed3395ba3de72aba70d7679dd85ebb034.1699267422.git.ps@pks.im>
- In-Reply-To
- <cover.1699267422.git.ps@pks.im>
We're setting up the Git directory twice in the `test-tool bloom` helper, once at the beginning of `cmd_bloom()` and once in the local subcommand implementation `get_bloom_filter_for_commit()`. This can lead to memory leaks as we'll overwrite variables of `the_repository` with newly allocated data structures. On top of that it's simply unnecessary.
Fix this by only setting up the Git directory once.
Signed-off-by: Patrick Steinhardt <ps@pks.im> --- t/helper/test-bloom.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c index aabe31d724b..1281e66876f 100644 --- a/t/helper/test-bloom.c +++ b/t/helper/test-bloom.c @@ -40,7 +40,6 @@ static void get_bloom_filter_for_commit(const struct object_id *commit_oid) { struct commit *c; struct bloom_filter *filter; - setup_git_directory(); c = lookup_commit(the_repository, commit_oid); filter = get_or_compute_bloom_filter(the_repository, c, 1, &settings,
-- 2.42.0