[COVERITY] Fix (error case only) memory leak in e2fsck_get_journal

Coverity ID: 43: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Brian Behlendorf 2007-03-29 00:19:17 -04:00 committed by Theodore Ts'o
parent 06c9c6ffc1
commit 2bfe0bdba3
2 changed files with 17 additions and 14 deletions

View File

@ -3,6 +3,7 @@
* pass1.c (e2fsck_pass1, check_ext_attr),
pass5.c (check_block_bitmaps, check_inode_bitmaps),
pass4.c (e2fsck_pass4), swapfs.c (swap_inodes),
journal.c (e2fsck_get_journal),
unix.c (parse_extended_opts): Fix memory leaks
2007-03-21 Theodore Tso <tytso@mit.edu>

View File

@ -231,8 +231,10 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
journal->j_blocksize = ctx->fs->blocksize;
if (uuid_is_null(sb->s_journal_uuid)) {
if (!sb->s_journal_inum)
return EXT2_ET_BAD_INODE_NUM;
if (!sb->s_journal_inum) {
retval = EXT2_ET_BAD_INODE_NUM;
goto errout;
}
j_inode = e2fsck_allocate_memory(ctx, sizeof(*j_inode),
"journal inode");
if (!j_inode) {
@ -314,7 +316,8 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
if (!journal_name) {
fix_problem(ctx, PR_0_CANT_FIND_JOURNAL, &pctx);
return EXT2_ET_LOAD_EXT_JOURNAL;
retval = EXT2_ET_LOAD_EXT_JOURNAL;
goto errout;
}
jfs_debug(1, "Using journal file %s\n", journal_name);
@ -397,7 +400,6 @@ errout:
if (journal)
ext2fs_free_mem(&journal);
return retval;
}
static errcode_t e2fsck_journal_fix_bad_inode(e2fsck_t ctx,