Commit 09771430 authored by Shen Feng's avatar Shen Feng Committed by 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: default avatarShen Feng <shen@cn.fujitsu.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent b5555f77
......@@ -3481,8 +3481,10 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
if (dir) {
ret = btrfs_set_inode_index(dir, index);
if (ret)
if (ret) {
iput(inode);
return ERR_PTR(ret);
}
}
/*
* index_cnt is ignored for everything but a dir,
......@@ -3565,6 +3567,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
if (dir)
BTRFS_I(dir)->index_cnt--;
btrfs_free_path(path);
iput(inode);
return ERR_PTR(ret);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment