diff options
author | Martin Ågren <martin.agren@gmail.com> | 2017-09-23 01:34:54 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-24 10:06:08 +0900 |
commit | 4d01a7fa65c50e817a935396432e199b7a565f53 (patch) | |
tree | 32beebc4564f7b19405f3b8f2fefb70b59606836 /pack-bitmap-write.c | |
parent | object_array: add and use `object_array_pop()` (diff) | |
download | tgif-4d01a7fa65c50e817a935396432e199b7a565f53.tar.xz |
pack-bitmap[-write]: use `object_array_clear()`, don't leak
Instead of setting the fields of rev->pending to 0/NULL, thereby leaking
memory, call `object_array_clear(&rev->pending)`.
In pack-bitmap.c, we make copies of those fields as `pending_nr` and
`pending_e`. We never update the aliases and the original fields never
change, so the aliases are not really needed and just make it harder
than necessary to understand the code. While we're here, remove the
aliases to make the code easier to follow.
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-bitmap-write.c')
-rw-r--r-- | pack-bitmap-write.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index 8e47a96b3b..a8df5ce2ab 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -297,9 +297,7 @@ void bitmap_writer_build(struct packing_data *to_pack) traverse_commit_list(&revs, show_commit, show_object, base); - revs.pending.nr = 0; - revs.pending.alloc = 0; - revs.pending.objects = NULL; + object_array_clear(&revs.pending); stored->bitmap = bitmap_to_ewah(base); need_reset = 0; |