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>
This commit is contained in:
		
					parent
					
						
							
								6d07bcec96
							
						
					
				
			
			
				commit
				
					
						42838bb265
					
				
			
		
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue