pack-bitmap.c: don't leak type-level bitmaps

test_bitmap_walk() is used to implement `git rev-list --test-bitmap`, which compares the result of the on-disk bitmaps with ones generated on-the-fly during a revision walk. In fa95666a40 (pack-bitmap.c: harden 'test_bitmap_walk()' to check type bitmaps, 2021-08-24), we hardened those tests to also check the four special type-level bitmaps, but never freed those bitmaps. We should have, since each required an allocation when we EWAH-decompressed them. Free those, plugging that leak, and also free the base (the scratch-pad bitmap), too. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Taylor Blau committed Oct 26, 2021 at 17:01 UTC 022815114a8a57188bc0e8fd622e10d5e22604dc
1 file changed +6
pack-bitmap.c
+6
@@ -1726,6 +1726,12 @@ void test_bitmap_walk(struct rev_info *revs)
1726 else
1727 die("mismatch in bitmap results");
1728
1729 + bitmap_free(result);
1730 + bitmap_free(tdata.base);
1731 + bitmap_free(tdata.commits);
1732 + bitmap_free(tdata.trees);
1733 + bitmap_free(tdata.blobs);
1734 + bitmap_free(tdata.tags);
1735 free_bitmap_index(bitmap_git);
1736 }
1737