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

Jia Guo guojia12 at huawei.com
Tue Jan 29 00:25:44 PST 2019



On 2019/1/28 17:47, Joseph Qi wrote:
> 
> On 19/1/28 09:48, Jia Guo wrote:
>> Release memory before mkfs.ocfs2 exit.
> 
> ocfs2_filesys will be released when process exit.
> 
> Thanks,
> Joseph
I think it's probably a matter of programming habits.

Thanks,
Jia
>>
>> 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