lkml.org 
[lkml]   [2017]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/4] f2fs: avoid memory leak in f2fs_write_root_inode
Date
Before exiting f2fs_write_root_inode, we should free in-there allocated
memory.

Signed-off-by: Chao Yu <yuchao0@huawei.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
\
 
 \ /
  Last update: 2017-11-17 17:17    [W:0.032 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site