summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorYoshinori Sano <yoshinori.sano@gmail.com>2011-04-09 02:30:07 +0000
committerChris Mason <chris.mason@oracle.com>2011-04-11 20:25:06 -0400
commit8fb27640d0e2b43c5584bf0087431b7b8d3c319a (patch)
tree0d25f1135a004ab7d88441f9aa8b235bd033077b /fs
parentc9ddec74aa950a220cc4caa5215cfc5d886050b7 (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.c5
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,
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);
}