mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2025-01-11 19:13:23 +08:00
[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:
parent
06c9c6ffc1
commit
2bfe0bdba3
@ -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>
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user