Skip to content

Commit 0228151

Browse files
ttaylorrgitster
authored andcommitted
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 fa95666 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 60980ae commit 0228151

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pack-bitmap.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,12 @@ void test_bitmap_walk(struct rev_info *revs)
17261726
else
17271727
die("mismatch in bitmap results");
17281728

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);
17291735
free_bitmap_index(bitmap_git);
17301736
}
17311737

0 commit comments

Comments
 (0)