Skip to content

Commit

Permalink
[PATCH] freevxfs: fix leak on error path
Browse files Browse the repository at this point in the history
If register_filesystem() fails, vxfs_inode cache must be destroyed.

Signed-off-by: Alexey Dobriyan <[email protected]>
Acked-by: Christoph Hellwig <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and Linus Torvalds committed Sep 29, 2006
1 parent 50d44ed commit a4376e1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions fs/freevxfs/vxfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,17 @@ static struct file_system_type vxfs_fs_type = {
static int __init
vxfs_init(void)
{
int rv;

vxfs_inode_cachep = kmem_cache_create("vxfs_inode",
sizeof(struct vxfs_inode_info), 0,
SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL, NULL);
if (vxfs_inode_cachep)
return register_filesystem(&vxfs_fs_type);
return -ENOMEM;
if (!vxfs_inode_cachep)
return -ENOMEM;
rv = register_filesystem(&vxfs_fs_type);
if (rv < 0)
kmem_cache_destroy(vxfs_inode_cachep);
return rv;
}

static void __exit
Expand Down

0 comments on commit a4376e1

Please sign in to comment.