mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-23 10:10:00 +00:00
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:
parent
67de42f76a
commit
43095ca4c2
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user