From: Junio C Hamano Date: Thu, 22 Mar 2018 21:24:12 +0000 (-0700) Subject: Merge branch 'jt/fsck-code-cleanup' into maint X-Git-Tag: v2.16.3~25 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d78b7eb2d50bd1cf57d7f06c1b4bdd8e08057926?hp=34b9ec8dd9bf6d3f6fa04f295351f917042a33fa Merge branch 'jt/fsck-code-cleanup' into maint Plug recently introduced leaks in fsck. * jt/fsck-code-cleanup: fsck: fix leak when traversing trees --- diff --git a/builtin/fsck.c b/builtin/fsck.c index 04846d46f9..92ce775a74 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -171,7 +171,13 @@ static void mark_object_reachable(struct object *obj) static int traverse_one_object(struct object *obj) { - return fsck_walk(obj, obj, &fsck_walk_options); + int result = fsck_walk(obj, obj, &fsck_walk_options); + + if (obj->type == OBJ_TREE) { + struct tree *tree = (struct tree *)obj; + free_tree_buffer(tree); + } + return result; } static int traverse_reachable(void)