diff options
| author | Taylor Blau <me@ttaylorr.com> | 2024-05-14 15:57:06 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-05-15 06:53:46 -0700 |
| commit | 85f360fee53933d230fd231db5306b26809fabcf (patch) | |
| tree | fa1e634ca5ca69ec0eddeb44b3d132ff6aeba37e /pack-bitmap-write.c | |
| parent | f25e1f2a4d48c6d8bfd659338d4415c7ef4df533 (diff) | |
pack-bitmap: introduce `bitmap_writer_free()`
Now that there is clearer memory ownership around the bitmap_writer
structure, introduce a bitmap_writer_free() function that callers may
use to free any memory associated with their instance of the
bitmap_writer structure.
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.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index 420f17c2e0..6cae670412 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -32,6 +32,29 @@ void bitmap_writer_init(struct bitmap_writer *writer) memset(writer, 0, sizeof(struct bitmap_writer)); } +void bitmap_writer_free(struct bitmap_writer *writer) +{ + uint32_t i; + + if (!writer) + return; + + ewah_free(writer->commits); + ewah_free(writer->trees); + ewah_free(writer->blobs); + ewah_free(writer->tags); + + kh_destroy_oid_map(writer->bitmaps); + + for (i = 0; i < writer->selected_nr; i++) { + struct bitmapped_commit *bc = &writer->selected[i]; + if (bc->write_as != bc->bitmap) + ewah_free(bc->write_as); + ewah_free(bc->bitmap); + } + free(writer->selected); +} + void bitmap_writer_show_progress(struct bitmap_writer *writer, int show) { writer->show_progress = show; |
