From: Junio C Hamano Date: Fri, 18 Aug 2017 20:53:00 +0000 (-0700) Subject: Merge branch 'rs/fsck-obj-leakfix' into next X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/77e3d111ef84e6f93427495f6f1d784b52ad08b8 Merge branch 'rs/fsck-obj-leakfix' into next Memory leak in an error codepath has been plugged. * rs/fsck-obj-leakfix: fsck: free buffers on error in fsck_obj() --- 77e3d111ef84e6f93427495f6f1d784b52ad08b8 diff --cc builtin/fsck.c index a92f448186,ab0de7b9d3..b0964a8d34 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@@ -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) { /*