Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t/helper
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2021-10-07 05:24:40 +0300
committerJunio C Hamano <gitster@pobox.com>2021-10-07 21:01:22 +0300
commite861b0963626dd2732f7efbf2a187a85b060d9cb (patch)
tree6e813daac052e5dab2dbab6802d3ecc72cf8bd55 /t/helper
parent324efc90d1b1a660388f8cabbb72e803160082d3 (diff)
test-read-midx: fix leak of bitmap_index struct
In read_midx_preferred_pack(), we open the bitmap index but never free it. This isn't a big deal since this is just a test helper, and we exit immediately after, but since we're trying to keep our leak-checking tidy now, it's worth fixing. Signed-off-by: Jeff King <peff@peff.net> Acked-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper')
-rw-r--r--t/helper/test-read-midx.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c
index 0038559129..9d6fa7a377 100644
--- a/t/helper/test-read-midx.c
+++ b/t/helper/test-read-midx.c
@@ -85,11 +85,15 @@ static int read_midx_preferred_pack(const char *object_dir)
return 1;
bitmap = prepare_bitmap_git(the_repository);
- if (!(bitmap && bitmap_is_midx(bitmap)))
+ if (!bitmap)
return 1;
-
+ if (!bitmap_is_midx(bitmap)) {
+ free_bitmap_index(bitmap);
+ return 1;
+ }
printf("%s\n", midx->pack_names[midx_preferred_pack(bitmap)]);
+ free_bitmap_index(bitmap);
return 0;
}