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>
This commit is contained in:

committed by
Junio C Hamano

parent
75b2f01a0f
commit
9784f97321
2
commit.c
2
commit.c
@ -365,8 +365,8 @@ struct object_id *get_commit_tree_oid(const struct commit *commit)
|
|||||||
void release_commit_memory(struct parsed_object_pool *pool, struct commit *c)
|
void release_commit_memory(struct parsed_object_pool *pool, struct commit *c)
|
||||||
{
|
{
|
||||||
set_commit_tree(c, NULL);
|
set_commit_tree(c, NULL);
|
||||||
c->index = 0;
|
|
||||||
free_commit_buffer(pool, c);
|
free_commit_buffer(pool, c);
|
||||||
|
c->index = 0;
|
||||||
free_commit_list(c->parents);
|
free_commit_list(c->parents);
|
||||||
|
|
||||||
c->object.parsed = 0;
|
c->object.parsed = 0;
|
||||||
|
Reference in New Issue
Block a user