summaryrefslogtreecommitdiff
path: root/pack-bitmap-write.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2021-08-24 16:15:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-08-24 20:21:13 (GMT)
commit1d7f7f242c89947c3f0bc0ade651e614a2f0a38f (patch)
treee396065a9717d178af2a273efc903b60163e2e14 /pack-bitmap-write.c
parent3ba3d0621b6822e974f06123db9394b33e454ed7 (diff)
downloadgit-1d7f7f242c89947c3f0bc0ade651e614a2f0a38f.zip
git-1d7f7f242c89947c3f0bc0ade651e614a2f0a38f.tar.gz
git-1d7f7f242c89947c3f0bc0ade651e614a2f0a38f.tar.bz2
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 341fa34887 (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 <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-bitmap-write.c')
-rw-r--r--pack-bitmap-write.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index d374f78..142fd0a 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -520,6 +520,7 @@ int bitmap_writer_build(struct packing_data *to_pack)
clear_prio_queue(&queue);
clear_prio_queue(&tree_queue);
bitmap_builder_clear(&bb);
+ free_bitmap_index(old_bitmap);
free(mapping);
trace2_region_leave("pack-bitmap-write", "building_bitmaps_total",