Skip to content

Commit 655b856

Browse files
ttaylorrgitster
authored andcommitted
pack-bitmap.c: more aggressively free in free_bitmap_index()
The function free_bitmap_index() is somewhat lax in what it frees. There are two notable examples: - While it does call kh_destroy_oid_map on the "bitmaps" map, which maps commit OIDs to their corresponding bitmaps, the bitmaps themselves are not freed. Note here that we recycle already-freed ewah_bitmaps into a pool, but these are handled correctly by ewah_pool_free(). - We never bother to free the extended index's "positions" map, which we always allocate in load_bitmap(). Fix both of these. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0228151 commit 655b856

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pack-bitmap.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,9 +1859,17 @@ void free_bitmap_index(struct bitmap_index *b)
18591859
ewah_pool_free(b->trees);
18601860
ewah_pool_free(b->blobs);
18611861
ewah_pool_free(b->tags);
1862+
if (b->bitmaps) {
1863+
struct stored_bitmap *sb;
1864+
kh_foreach_value(b->bitmaps, sb, {
1865+
ewah_pool_free(sb->root);
1866+
free(sb);
1867+
});
1868+
}
18621869
kh_destroy_oid_map(b->bitmaps);
18631870
free(b->ext_index.objects);
18641871
free(b->ext_index.hashes);
1872+
kh_destroy_oid_pos(b->ext_index.positions);
18651873
bitmap_free(b->result);
18661874
bitmap_free(b->haves);
18671875
if (bitmap_is_midx(b)) {

0 commit comments

Comments
 (0)