提交 ba3a08ca 编写于 作者: E Eric Wong 提交者: Junio C Hamano

fsck: fix leak when traversing trees

While fsck_walk/fsck_walk_tree/parse_tree populates "struct tree"
idempotently, it is still up to the fsck_walk caller to call
free_tree_buffer.

Fixes: ad2db403 ("fsck: remove redundant parse_tree() invocation")
Signed-off-by: NEric Wong <e@80x24.org>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 78e7b98f
......@@ -170,7 +170,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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册