Skip to content

Commit

Permalink
udf: fix memory leak while allocating blocks during write
Browse files Browse the repository at this point in the history
Need to brelse the buffer_head stored in cur_epos and next_epos.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Namjae Jeon authored and Jan Kara committed Dec 13, 2012
1 parent 25389bb commit 2fb7d99
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/udf/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
goal, err);
if (!newblocknum) {
brelse(prev_epos.bh);
brelse(cur_epos.bh);
brelse(next_epos.bh);
*err = -ENOSPC;
return 0;
}
Expand Down Expand Up @@ -795,6 +797,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
udf_update_extents(inode, laarr, startnum, endnum, &prev_epos);

brelse(prev_epos.bh);
brelse(cur_epos.bh);
brelse(next_epos.bh);

newblock = udf_get_pblock(inode->i_sb, newblocknum,
iinfo->i_location.partitionReferenceNum, 0);
Expand Down

0 comments on commit 2fb7d99

Please sign in to comment.