[Ocfs2-tools-devel] [PATCH v2] mkfs.ocfs2: release memory before mkfs.ocfs2 exit

Jia Guo guojia12 at huawei.com
Sun Jan 27 17:48:27 PST 2019


Release memory before mkfs.ocfs2 exit.

Signed-off-by: Jia Guo <guojia12 at huawei.com>
---
 mkfs.ocfs2/mkfs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mkfs.ocfs2/mkfs.c b/mkfs.ocfs2/mkfs.c
index 932b905..5f240ac 100644
--- a/mkfs.ocfs2/mkfs.c
+++ b/mkfs.ocfs2/mkfs.c
@@ -439,6 +439,7 @@ static void format_quota_files(State *s, ocfs2_filesys *fs)
 	return;
 error:
 	clear_both_ends(s);
+	ocfs2_close(fs);
 	exit(1);
 }

@@ -461,6 +462,7 @@ static void grow_extent_allocator(State *s, ocfs2_filesys *fs)

 error:
 	clear_both_ends(s);
+	ocfs2_close(fs);
 	exit(1);
 }

@@ -3085,6 +3087,7 @@ static void index_system_dirs(State *s, ocfs2_filesys *fs)

 bail:
 	clear_both_ends(s);
+	ocfs2_close(fs);
 	exit(1);
 }

@@ -3117,6 +3120,7 @@ static void create_lost_found_dir(State *s, ocfs2_filesys *fs)

 bail:
 	clear_both_ends(s);
+	ocfs2_close(fs);
 	exit(1);
 }

@@ -3161,6 +3165,7 @@ static void format_journals(State *s, ocfs2_filesys *fs)

 error:
 	clear_both_ends(s);
+	ocfs2_close(fs);
 	exit(1);
 }

@@ -3172,6 +3177,7 @@ static void format_slotmap(State *s, ocfs2_filesys *fs)
 	if (ret) {
 		com_err(s->progname, ret, "while formatting the slot map");
 		clear_both_ends(s);
+		ocfs2_close(fs);
 		exit(1);
 	}
 }
@@ -3204,6 +3210,7 @@ static int format_backup_super(State *s, ocfs2_filesys *fs)

 error:
 	clear_both_ends(s);
+	ocfs2_close(fs);
 	exit(1);
 }



More information about the Ocfs2-tools-devel mailing list