JBD/JBD2: free j_wbuf if journal init fails.
authorTao Ma <tao.ma@oracle.com>
Tue, 10 Nov 2009 09:13:22 +0000 (17:13 +0800)
committerJan Kara <jack@suse.cz>
Wed, 11 Nov 2009 14:24:14 +0000 (15:24 +0100)
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>
fs/jbd/journal.c
fs/jbd2/journal.c

index bd3c073b485d99a5e0406016ef201aabfbee07ad..49d5cd6053c868f7011d7659dccedefbda90a3b5 100644 (file)
@@ -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;
 }
@@ -820,6 +821,7 @@ journal_t * journal_init_inode (struct inode *inode)
 
        return journal;
 out_err:
+       kfree(journal->j_wbuf);
        kfree(journal);
        return NULL;
 }
index b0ab5219becbd92e34c6676a93716e102e70abe9..fed85388ee86434509805091a933b34091c50596 100644 (file)
@@ -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;
@@ -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;