diff options
author | Yoshinori Sano <yoshinori.sano@gmail.com> | 2011-04-08 22:30:07 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-04-11 20:25:06 -0400 |
commit | 8fb27640d0e2b43c5584bf0087431b7b8d3c319a (patch) | |
tree | 0d25f1135a004ab7d88441f9aa8b235bd033077b /fs | |
parent | c9ddec74aa950a220cc4caa5215cfc5d886050b7 (diff) |
Btrfs: fix memory leaks in btrfs_new_inode()
This patch fixes memory leaks in btrfs_new_inode().
Signed-off-by: Yoshinori Sano <yoshinori.sano@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-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 cc6022842e0c..2d1208f964eb 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4526,14 +4526,17 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
4526 | BUG_ON(!path); | 4526 | BUG_ON(!path); |
4527 | 4527 | ||
4528 | inode = new_inode(root->fs_info->sb); | 4528 | inode = new_inode(root->fs_info->sb); |
4529 | if (!inode) | 4529 | if (!inode) { |
4530 | btrfs_free_path(path); | ||
4530 | return ERR_PTR(-ENOMEM); | 4531 | return ERR_PTR(-ENOMEM); |
4532 | } | ||
4531 | 4533 | ||
4532 | if (dir) { | 4534 | if (dir) { |
4533 | trace_btrfs_inode_request(dir); | 4535 | trace_btrfs_inode_request(dir); |
4534 | 4536 | ||
4535 | ret = btrfs_set_inode_index(dir, index); | 4537 | ret = btrfs_set_inode_index(dir, index); |
4536 | if (ret) { | 4538 | if (ret) { |
4539 | btrfs_free_path(path); | ||
4537 | iput(inode); | 4540 | iput(inode); |
4538 | return ERR_PTR(ret); | 4541 | return ERR_PTR(ret); |
4539 | } | 4542 | } |