Merge branch 'mh/release-commit-memory-fix'
authorJunio C Hamano <gitster@pobox.com>
Mon, 30 Sep 2019 04:19:25 +0000 (13:19 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Sep 2019 04:19:25 +0000 (13:19 +0900)
Leakfix.

* mh/release-commit-memory-fix:
commit: free the right buffer in release_commit_memory

1  2 
commit.c
diff --combined commit.c
index a98de16e3d570e09696a844b018bd4d580d9a30e,b44e3be8f6b9f85f1d5978bd8d66f1bb1ffc4df7..3fe5f8fa9c6e95e966bbebca3159e24595e1ee48
+++ b/commit.c
@@@ -57,9 -57,10 +57,9 @@@ struct commit *lookup_commit_or_die(con
  
  struct commit *lookup_commit(struct repository *r, const struct object_id *oid)
  {
 -      struct object *obj = lookup_object(r, oid->hash);
 +      struct object *obj = lookup_object(r, oid);
        if (!obj)
 -              return create_object(r, oid->hash,
 -                                   alloc_commit_node(r));
 +              return create_object(r, oid, alloc_commit_node(r));
        return object_as_type(r, obj, OBJ_COMMIT, 0);
  }
  
@@@ -364,8 -365,8 +364,8 @@@ struct object_id *get_commit_tree_oid(c
  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;