]> git.ipfire.org Git - thirdparty/git.git/commitdiff
pack-bitmap.c: don't leak type-level bitmaps
authorTaylor Blau <me@ttaylorr.com>
Tue, 26 Oct 2021 21:01:23 +0000 (17:01 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 Oct 2021 22:32:14 +0000 (15:32 -0700)
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>
pack-bitmap.c

index 3f603425c9bbe2c8dae53e344458459108e6390a..3d81425c29b63382473306e0a8e3891e6738f860 100644 (file)
@@ -1726,6 +1726,12 @@ void test_bitmap_walk(struct rev_info *revs)
        else
                die("mismatch in bitmap results");
 
+       bitmap_free(result);
+       bitmap_free(tdata.base);
+       bitmap_free(tdata.commits);
+       bitmap_free(tdata.trees);
+       bitmap_free(tdata.blobs);
+       bitmap_free(tdata.tags);
        free_bitmap_index(bitmap_git);
 }