Skip to content

Commit

Permalink
fix leak in __logfs_create()
Browse files Browse the repository at this point in the history
if kmalloc fails, we still need to drop the inode, as we do
on other failure exits.

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Aug 9, 2010
1 parent 0e4f6a7 commit 2562495
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/logfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2562495

Please sign in to comment.