提交 8fb27640 编写于 作者: Y Yoshinori Sano 提交者: Chris Mason

Btrfs: fix memory leaks in btrfs_new_inode()

This patch fixes memory leaks in btrfs_new_inode().
Signed-off-by: NYoshinori Sano <yoshinori.sano@gmail.com>
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 c9ddec74
...@@ -4526,14 +4526,17 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, ...@@ -4526,14 +4526,17 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
BUG_ON(!path); BUG_ON(!path);
inode = new_inode(root->fs_info->sb); inode = new_inode(root->fs_info->sb);
if (!inode) if (!inode) {
btrfs_free_path(path);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
if (dir) { if (dir) {
trace_btrfs_inode_request(dir); trace_btrfs_inode_request(dir);
ret = btrfs_set_inode_index(dir, index); ret = btrfs_set_inode_index(dir, index);
if (ret) { if (ret) {
btrfs_free_path(path);
iput(inode); 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.
先完成此消息的编辑!
想要评论请 注册