diff options
author | Seung-Woo Kim <sw0312.kim@samsung.com> | 2021-05-10 17:57:25 +0900 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2021-05-10 22:10:37 -0700 |
commit | 15d4d7be9457aa3a30e1b44c9ae452614cf14a6a (patch) | |
tree | 2a7141b1ff634ca79747578ddc268206b5d68d9d | |
parent | 1900c22ed2441bcef69010d0e46644914ae9f79f (diff) | |
download | f2fs-tools-15d4d7be9457aa3a30e1b44c9ae452614cf14a6a.tar.gz |
fsck.f2fs: fix memory leak caused by fsck_chk_orphan_node()
With invalid node info from fsck_chk_orphan_node(), orphan_blk
and new_blk are not freed. Fix memory leak in the path.
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fsck/fsck.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fsck/fsck.c b/fsck/fsck.c index e526720..6019775 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -1780,8 +1780,11 @@ int fsck_chk_orphan_node(struct f2fs_sb_info *sbi) if (c.preen_mode == PREEN_MODE_1 && !c.fix_on) { get_node_info(sbi, ino, &ni); if (!IS_VALID_NID(sbi, ino) || - !IS_VALID_BLK_ADDR(sbi, ni.blk_addr)) + !IS_VALID_BLK_ADDR(sbi, ni.blk_addr)) { + free(orphan_blk); + free(new_blk); return -EINVAL; + } continue; } |