Merge branch 'rs/fsck-obj-leakfix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 22 Aug 2017 17:29:13 +0000 (10:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 22 Aug 2017 17:29:14 +0000 (10:29 -0700)
Memory leak in an error codepath has been plugged.

* rs/fsck-obj-leakfix:
fsck: free buffers on error in fsck_obj()

1  2 
builtin/fsck.c
diff --cc builtin/fsck.c
index a92f44818610784091f8aac5ea14612be59cd184,ab0de7b9d3ef5002644b841825154af75dcde349..b0964a8d3499a6a288985f92ade5568356bd6a56
@@@ -365,10 -369,15 +360,15 @@@ static int fsck_obj(struct object *obj
                }
        }
  
-       return 0;
+ out:
+       if (obj->type == OBJ_TREE)
+               free_tree_buffer((struct tree *)obj);
+       if (obj->type == OBJ_COMMIT)
+               free_commit_buffer((struct commit *)obj);
+       return err;
  }
  
 -static int fsck_obj_buffer(const unsigned char *sha1, enum object_type type,
 +static int fsck_obj_buffer(const struct object_id *oid, enum object_type type,
                           unsigned long size, void *buffer, int *eaten)
  {
        /*