mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-11-28 12:34:13 +08:00
e2fsck: fix memory leaks (on error path)
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
parent
85b8f7affa
commit
f0131bdc6f
@ -1077,8 +1077,10 @@ int e2fsck_fix_ext3_journal_hint(e2fsck_t ctx)
|
||||
if (!journal_name)
|
||||
return 0;
|
||||
|
||||
if (stat(journal_name, &st) < 0)
|
||||
if (stat(journal_name, &st) < 0) {
|
||||
free(journal_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (st.st_rdev != sb->s_journal_dev) {
|
||||
clear_problem_context(&pctx);
|
||||
|
@ -53,7 +53,7 @@ static ext2fs_inode_bitmap inode_done_map = 0;
|
||||
void e2fsck_pass3(e2fsck_t ctx)
|
||||
{
|
||||
ext2_filsys fs = ctx->fs;
|
||||
struct dir_info_iter *iter;
|
||||
struct dir_info_iter *iter = NULL;
|
||||
#ifdef RESOURCE_TRACK
|
||||
struct resource_track rtrack;
|
||||
#endif
|
||||
@ -108,7 +108,6 @@ void e2fsck_pass3(e2fsck_t ctx)
|
||||
if (check_directory(ctx, dir->ino, &pctx))
|
||||
goto abort_exit;
|
||||
}
|
||||
e2fsck_dir_info_iter_end(ctx, iter);
|
||||
|
||||
/*
|
||||
* Force the creation of /lost+found if not present
|
||||
@ -123,6 +122,8 @@ void e2fsck_pass3(e2fsck_t ctx)
|
||||
e2fsck_rehash_directories(ctx);
|
||||
|
||||
abort_exit:
|
||||
if (iter)
|
||||
e2fsck_dir_info_iter_end(ctx, iter);
|
||||
e2fsck_free_dir_info(ctx);
|
||||
if (inode_loop_detect) {
|
||||
ext2fs_free_inode_bitmap(inode_loop_detect);
|
||||
|
@ -318,6 +318,8 @@ profile_init(const char **files, profile_t *ret_profile)
|
||||
/* if the filenames list is not specified return an empty profile */
|
||||
if ( files ) {
|
||||
for (fs = files; !PROFILE_LAST_FILESPEC(*fs); fs++) {
|
||||
if (array)
|
||||
free_list(array);
|
||||
retval = get_dirlist(*fs, &array);
|
||||
if (retval == 0) {
|
||||
if (!array)
|
||||
|
@ -869,6 +869,8 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
|
||||
case 'L':
|
||||
replace_bad_blocks++;
|
||||
case 'l':
|
||||
if (bad_blocks_file)
|
||||
free(bad_blocks_file);
|
||||
bad_blocks_file = string_copy(ctx, optarg, 0);
|
||||
break;
|
||||
case 'd':
|
||||
|
Loading…
Reference in New Issue
Block a user