From acac50dd8c2c9725841b3e9143d78c6345dc076c Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 12 Feb 2020 21:16:33 -0500 Subject: 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 Signed-off-by: Junio C Hamano --- object.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'object.c') diff --git a/object.c b/object.c index 142ef69399..4d11949b38 100644 --- a/object.c +++ b/object.c @@ -307,6 +307,15 @@ int object_list_contains(struct object_list *list, struct object *obj) return 0; } +void object_list_free(struct object_list **list) +{ + while (*list) { + struct object_list *p = *list; + *list = p->next; + free(p); + } +} + /* * A zero-length string to which object_array_entry::name can be * initialized without requiring a malloc/free. -- cgit v1.2.3