fix leak in __logfs_create()
Al Viro [Sun, 4 Jul 2010 08:23:11 +0000 (12:23 +0400)]
if kmalloc fails, we still need to drop the inode, as we do
on other failure exits.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

fs/logfs/dir.c

index 72d1893..675cc49 100644 (file)
@@ -434,8 +434,11 @@ static int __logfs_create(struct inode *dir, struct dentry *dentry,
        int ret;
 
        ta = kzalloc(sizeof(*ta), GFP_KERNEL);
-       if (!ta)
+       if (!ta) {
+               inode->i_nlink--;
+               iput(inode);
                return -ENOMEM;
+       }
 
        ta->state = CREATE_1;
        ta->ino = inode->i_ino;