diff options
author | Shen Feng <shen@cn.fujitsu.com> | 2009-04-02 16:46:06 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-04-02 16:46:06 -0400 |
commit | 09771430f3b46ee27c69daa7ecad82007568e834 (patch) | |
tree | eb51c0f62c3c0672102cf53a731ca6ed68e1be49 /fs/btrfs | |
parent | b5555f77115bfba3630fefff2d4e68140b644171 (diff) |
Btrfs: free inode struct when btrfs_new_inode fails
btrfs_new_inode doesn't call iput to free the inode
when it fails.
Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1cff528d5b51..0ecb3fa75dc3 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -3481,8 +3481,10 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
3481 | 3481 | ||
3482 | if (dir) { | 3482 | if (dir) { |
3483 | ret = btrfs_set_inode_index(dir, index); | 3483 | ret = btrfs_set_inode_index(dir, index); |
3484 | if (ret) | 3484 | if (ret) { |
3485 | iput(inode); | ||
3485 | return ERR_PTR(ret); | 3486 | return ERR_PTR(ret); |
3487 | } | ||
3486 | } | 3488 | } |
3487 | /* | 3489 | /* |
3488 | * index_cnt is ignored for everything but a dir, | 3490 | * index_cnt is ignored for everything but a dir, |
@@ -3565,6 +3567,7 @@ fail: | |||
3565 | if (dir) | 3567 | if (dir) |
3566 | BTRFS_I(dir)->index_cnt--; | 3568 | BTRFS_I(dir)->index_cnt--; |
3567 | btrfs_free_path(path); | 3569 | btrfs_free_path(path); |
3570 | iput(inode); | ||
3568 | return ERR_PTR(ret); | 3571 | return ERR_PTR(ret); |
3569 | } | 3572 | } |
3570 | 3573 | ||