Skip to content

Commit 1d7f7f2

Browse files
ttaylorrgitster
authored andcommitted
pack-bitmap-write.c: free existing bitmaps
When writing a new bitmap, the bitmap writer code attempts to read the existing bitmap (if one is present). This is done in order to quickly permute the bits of any bitmaps for commits which appear in the existing bitmap, and were also selected for the new bitmap. But since this code was added in 341fa34 (pack-bitmap-write: use existing bitmaps, 2020-12-08), the resources associated with opening an existing bitmap were never released. It's fine to ignore this, but it's bad hygiene. It will also cause a problem for the multi-pack-index builtin, which will be responsible not only for writing bitmaps, but also for expiring any old multi-pack bitmaps. If an existing bitmap was reused here, it will also be expired. That will cause a problem on platforms which require file resources to be closed before unlinking them, like Windows. Avoid this by ensuring we close reused bitmaps with free_bitmap_index() before removing them. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3ba3d06 commit 1d7f7f2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pack-bitmap-write.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ int bitmap_writer_build(struct packing_data *to_pack)
520520
clear_prio_queue(&queue);
521521
clear_prio_queue(&tree_queue);
522522
bitmap_builder_clear(&bb);
523+
free_bitmap_index(old_bitmap);
523524
free(mapping);
524525

525526
trace2_region_leave("pack-bitmap-write", "building_bitmaps_total",

0 commit comments

Comments
 (0)