From: Jesper Juhl Date: Thu, 6 Jan 2011 21:45:21 +0000 (+0000) Subject: btrfs: Mem leak in btrfs_get_acl() X-Git-Tag: upstream/snapshot3+hdmi~11282^2~48 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42838bb265b9cff3de9587fcacc398b5112dc2d9;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 2222d16..6d1410e 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) size = __btrfs_getxattr(inode, name, value, size); if (size > 0) { acl = posix_acl_from_xattr(value, size); - if (IS_ERR(acl)) + if (IS_ERR(acl)) { + kfree(value); return acl; + } set_cached_acl(inode, type, acl); } kfree(value);