aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd
diff options
context:
space:
mode:
authorZoltan Menyhart <Zoltan.Menyhart@bull.net>2006-09-29 04:58:40 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 12:18:03 -0400
commitd1807793e1e7e502e3dc047115e9dbc3b50e4534 (patch)
tree0ee76ff91643dc23fd5aef6d0498a7e139fdc6f8 /fs/jbd
parentf71b2f10f56802075d67c5710cd9f1816382d720 (diff)
[PATCH] JBD: memory leak in "journal_init_dev()"
We leak a bh ref in "journal_init_dev()" in case of failure. Signed-off-by: Zoltan Menyhart <Zoltan.Menyhart@bull.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/jbd')
-rw-r--r--fs/jbd/journal.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 2fc66c3e6681..7af6099c911c 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -715,18 +715,8 @@ journal_t * journal_init_dev(struct block_device *bdev,
715 if (!journal) 715 if (!journal)
716 return NULL; 716 return NULL;
717 717
718 journal->j_dev = bdev;
719 journal->j_fs_dev = fs_dev;
720 journal->j_blk_offset = start;
721 journal->j_maxlen = len;
722 journal->j_blocksize = blocksize;
723
724 bh = __getblk(journal->j_dev, start, journal->j_blocksize);
725 J_ASSERT(bh != NULL);
726 journal->j_sb_buffer = bh;
727 journal->j_superblock = (journal_superblock_t *)bh->b_data;
728
729 /* journal descriptor can store up to n blocks -bzzz */ 718 /* journal descriptor can store up to n blocks -bzzz */
719 journal->j_blocksize = blocksize;
730 n = journal->j_blocksize / sizeof(journal_block_tag_t); 720 n = journal->j_blocksize / sizeof(journal_block_tag_t);
731 journal->j_wbufsize = n; 721 journal->j_wbufsize = n;
732 journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); 722 journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL);
@@ -736,6 +726,15 @@ journal_t * journal_init_dev(struct block_device *bdev,
736 kfree(journal); 726 kfree(journal);
737 journal = NULL; 727 journal = NULL;
738 } 728 }
729 journal->j_dev = bdev;
730 journal->j_fs_dev = fs_dev;
731 journal->j_blk_offset = start;
732 journal->j_maxlen = len;
733
734 bh = __getblk(journal->j_dev, start, journal->j_blocksize);
735 J_ASSERT(bh != NULL);
736 journal->j_sb_buffer = bh;
737 journal->j_superblock = (journal_superblock_t *)bh->b_data;
739 738
740 return journal; 739 return journal;
741} 740}