Skip to content

Commit

Permalink
Btrfs: fix memory leaks in btrfs_new_inode()
Browse files Browse the repository at this point in the history
This patch fixes memory leaks in btrfs_new_inode().

Signed-off-by: Yoshinori Sano <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
yoshinorisano authored and chrismason-xx committed Apr 12, 2011
1 parent c9ddec7 commit 8fb2764
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4526,14 +4526,17 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
BUG_ON(!path);

inode = new_inode(root->fs_info->sb);
if (!inode)
if (!inode) {
btrfs_free_path(path);
return ERR_PTR(-ENOMEM);
}

if (dir) {
trace_btrfs_inode_request(dir);

ret = btrfs_set_inode_index(dir, index);
if (ret) {
btrfs_free_path(path);
iput(inode);
return ERR_PTR(ret);
}
Expand Down

0 comments on commit 8fb2764

Please sign in to comment.