summaryrefslogtreecommitdiff
path: root/t/helper
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2021-10-06 22:24:40 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-10-07 11:01:22 -0700
commite861b0963626dd2732f7efbf2a187a85b060d9cb (patch)
tree6e813daac052e5dab2dbab6802d3ecc72cf8bd55 /t/helper
parentbuiltin/repack.c: pass `--refs-snapshot` when writing bitmaps (diff)
downloadtgif-e861b0963626dd2732f7efbf2a187a85b060d9cb.tar.xz
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;
}