pack-bitmap: fix leak of haves/wants object lists

When we do a bitmap-aware revision traversal, we create an object_list
for each of the "haves" and "wants" tips. After creating the result
bitmaps these are no longer needed or used, but we never free the list
memory.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2020-02-12 21:16:33 -05:00
committed by Junio C Hamano
parent 551cf8b655
commit acac50dd8c
3 changed files with 16 additions and 0 deletions

View File

@ -787,10 +787,15 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs)
bitmap_git->result = wants_bitmap;
bitmap_git->haves = haves_bitmap;
object_list_free(&wants);
object_list_free(&haves);
return bitmap_git;
cleanup:
free_bitmap_index(bitmap_git);
object_list_free(&wants);
object_list_free(&haves);
return NULL;
}