]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit: free the right buffer in release_commit_memory
authorMike Hommey <mh@glandium.org>
Mon, 26 Aug 2019 02:01:37 +0000 (11:01 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Aug 2019 17:53:25 +0000 (10:53 -0700)
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>
commit.c

index 26ce0770f688eb94d5be5975d756752dbc0337a8..b44e3be8f6b9f85f1d5978bd8d66f1bb1ffc4df7 100644 (file)
--- a/commit.c
+++ b/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)
 {
        set_commit_tree(c, NULL);
-       c->index = 0;
        free_commit_buffer(pool, c);
+       c->index = 0;
        free_commit_list(c->parents);
 
        c->object.parsed = 0;