commit: free the right buffer in release_commit_memory

The index field in the commit object is used to find the buffer corresponding to that commit in the buffer_slab. Resetting it first means free_commit_buffer is not going to free the right buffer. Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Mike Hommey committed Aug 26, 2019 at 11:01 UTC 9784f9732165bf01c039d7fae2f0fba9bd06a015
1 file changed +1 -1
commit.c
+1 -1
@@ -365,8 +365,8 @@ struct object_id *get_commit_tree_oid(const struct commit *commit)
365 void release_commit_memory(struct parsed_object_pool *pool, struct commit *c)
366 {
367 set_commit_tree(c, NULL);
368 - c->index = 0;
368 free_commit_buffer(pool, c);
369 + c->index = 0;
370 free_commit_list(c->parents);
371
372 c->object.parsed = 0;