Skip to content

Commit 9784f97

Browse files
glandiumgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 75b2f01 commit 9784f97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ struct object_id *get_commit_tree_oid(const struct commit *commit)
365365
void release_commit_memory(struct parsed_object_pool *pool, struct commit *c)
366366
{
367367
set_commit_tree(c, NULL);
368-
c->index = 0;
369368
free_commit_buffer(pool, c);
369+
c->index = 0;
370370
free_commit_list(c->parents);
371371

372372
c->object.parsed = 0;

0 commit comments

Comments
 (0)