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

Jia Guo guojia12 at huawei.com
Thu Jan 24 23:42:14 PST 2019


Release memory before mkfs.ocfs2 exit.

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

diff --git a/mkfs.ocfs2/mkfs.c b/mkfs.ocfs2/mkfs.c
index 932b905..4a0f741 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);
 }

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

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

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

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

@@ -3172,6 +3176,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);
 	}
 }




More information about the Ocfs2-tools-devel mailing list