Skip to content

Commit

Permalink
JBD/JBD2: free j_wbuf if journal init fails.
Browse files Browse the repository at this point in the history
If journal init fails, we need to free j_wbuf.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Tao Ma authored and Jan Kara committed Nov 11, 2009
1 parent fe8bc91 commit 7b02bec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/jbd/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ journal_t * journal_init_dev(struct block_device *bdev,

return journal;
out_err:
kfree(journal->j_wbuf);
kfree(journal);
return NULL;
}
Expand Down Expand Up @@ -820,6 +821,7 @@ journal_t * journal_init_inode (struct inode *inode)

return journal;
out_err:
kfree(journal->j_wbuf);
kfree(journal);
return NULL;
}
Expand Down
2 changes: 2 additions & 0 deletions fs/jbd2/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev,

return journal;
out_err:
kfree(journal->j_wbuf);
jbd2_stats_proc_exit(journal);
kfree(journal);
return NULL;
Expand Down Expand Up @@ -986,6 +987,7 @@ journal_t * jbd2_journal_init_inode (struct inode *inode)

return journal;
out_err:
kfree(journal->j_wbuf);
jbd2_stats_proc_exit(journal);
kfree(journal);
return NULL;
Expand Down

0 comments on commit 7b02bec

Please sign in to comment.