diff --git a/builtin/fsck.c b/builtin/fsck.c index 04846d46f91d6cde14d379da8e0e3dd458c08dc5..92ce775a74d88036b024b24d74e3987da521ef41 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)