summaryrefslogtreecommitdiff
path: root/builtin/pack-objects.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2024-05-14 15:57:06 -0400
committerJunio C Hamano <gitster@pobox.com>2024-05-15 06:53:46 -0700
commit85f360fee53933d230fd231db5306b26809fabcf (patch)
treefa1e634ca5ca69ec0eddeb44b3d132ff6aeba37e /builtin/pack-objects.c
parentf25e1f2a4d48c6d8bfd659338d4415c7ef4df533 (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 'builtin/pack-objects.c')
-rw-r--r--builtin/pack-objects.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 10e69fdc8e..26a6d0d791 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1245,7 +1245,6 @@ static void write_pack_file(void)
uint32_t nr_remaining = nr_result;
time_t last_mtime = 0;
struct object_entry **write_order;
- struct bitmap_writer bitmap_writer;
if (progress > pack_to_stdout)
progress_state = start_progress(_("Writing objects"), nr_result);
@@ -1315,6 +1314,7 @@ static void write_pack_file(void)
if (!pack_to_stdout) {
struct stat st;
struct strbuf tmpname = STRBUF_INIT;
+ struct bitmap_writer bitmap_writer;
char *idx_tmp_name = NULL;
/*
@@ -1370,6 +1370,7 @@ static void write_pack_file(void)
bitmap_writer_finish(&bitmap_writer,
written_list, nr_written,
tmpname.buf, write_bitmap_options);
+ bitmap_writer_free(&bitmap_writer);
write_bitmap_index = 0;
strbuf_setlen(&tmpname, tmpname_len);
}