提交 09771430 编写于 作者: S Shen Feng 提交者: Chris Mason

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: NShen Feng <shen@cn.fujitsu.com>
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 b5555f77
...@@ -3481,8 +3481,10 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, ...@@ -3481,8 +3481,10 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
if (dir) { if (dir) {
ret = btrfs_set_inode_index(dir, index); ret = btrfs_set_inode_index(dir, index);
if (ret) if (ret) {
iput(inode);
return ERR_PTR(ret); return ERR_PTR(ret);
}
} }
/* /*
* index_cnt is ignored for everything but a dir, * index_cnt is ignored for everything but a dir,
...@@ -3565,6 +3567,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, ...@@ -3565,6 +3567,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
if (dir) if (dir)
BTRFS_I(dir)->index_cnt--; BTRFS_I(dir)->index_cnt--;
btrfs_free_path(path); btrfs_free_path(path);
iput(inode);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册