[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171116115058.110552-3-yuchao0@huawei.com>
Date: Thu, 16 Nov 2017 19:50:57 +0800
From: Chao Yu <yuchao0@...wei.com>
To: <jaegeuk@...nel.org>
CC: <linux-f2fs-devel@...ts.sourceforge.net>,
<linux-kernel@...r.kernel.org>, <chao@...nel.org>,
Chao Yu <yuchao0@...wei.com>
Subject: [PATCH 3/4] f2fs: avoid memory leak in f2fs_write_root_inode
Before exiting f2fs_write_root_inode, we should free in-there allocated
memory.
Signed-off-by: Chao Yu <yuchao0@...wei.com>
---
mkfs/f2fs_format.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index d5f39ca3dac4..9fc0398fab65 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -1042,6 +1042,7 @@ static int f2fs_write_root_inode(void)
c.blks_per_seg, main_area_node_seg_blk_offset);
if (dev_write_block(raw_node, main_area_node_seg_blk_offset)) {
MSG(1, "\tError: While writing the raw_node to disk!!!\n");
+ free(raw_node);
return -1;
}
@@ -1052,9 +1053,11 @@ static int f2fs_write_root_inode(void)
#ifndef WITH_ANDROID
if (discard_obsolete_dnode(raw_node, main_area_node_seg_blk_offset)) {
+ free(raw_node);
return -1;
}
#endif
+ free(raw_node);
return 0;
}
--
2.15.0.55.gc2ece9dc4de6
Powered by blists - more mailing lists