fsck.f2fs: deal with realloc failure

Deal with realloc failure to avoid memory leak and memory free.

Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Liu Xue 2015-12-01 08:34:43 +00:00 committed by Jaegeuk Kim
parent 67de42f76a
commit 43095ca4c2

View File

@ -843,7 +843,10 @@ static void print_dentry(__u32 depth, __u8 *name,
if (tree_mark_size <= depth) {
tree_mark_size *= 2;
tree_mark = realloc(tree_mark, tree_mark_size);
char *tree_mark_old = realloc(tree_mark, tree_mark_size);
ASSERT(tree_mark_old != NULL);
tree_mark = tree_mark_old;
free(tree_mark_old);
}
if (last_de)