diff options
author | Jesper Juhl <jj@chaosbits.net> | 2011-01-06 16:45:21 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-01-16 11:30:19 -0500 |
commit | 42838bb265b9cff3de9587fcacc398b5112dc2d9 (patch) | |
tree | 4c0cfbe4f41004b096917ddf75ed7d74743a4af3 /fs/btrfs/acl.c | |
parent | 6d07bcec969af335d4e35b3921131b7929bd634e (diff) |
btrfs: Mem leak in btrfs_get_acl()
It seems to me that we leak the memory allocated to 'value' in
btrfs_get_acl() if the call to posix_acl_from_xattr() fails.
Here's a patch that attempts to correct that problem.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/acl.c')
-rw-r--r-- | fs/btrfs/acl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 2222d161c7b6..6d1410e392d3 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -60,8 +60,10 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type) | |||
60 | size = __btrfs_getxattr(inode, name, value, size); | 60 | size = __btrfs_getxattr(inode, name, value, size); |
61 | if (size > 0) { | 61 | if (size > 0) { |
62 | acl = posix_acl_from_xattr(value, size); | 62 | acl = posix_acl_from_xattr(value, size); |
63 | if (IS_ERR(acl)) | 63 | if (IS_ERR(acl)) { |
64 | kfree(value); | ||
64 | return acl; | 65 | return acl; |
66 | } | ||
65 | set_cached_acl(inode, type, acl); | 67 | set_cached_acl(inode, type, acl); |
66 | } | 68 | } |
67 | kfree(value); | 69 | kfree(value); |