linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] freevxfs: fix leak on error path
@ 2006-08-25  1:03 Alexey Dobriyan
  2006-08-25  6:13 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2006-08-25  1:03 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-fsdevel, Christoph Hellwig

If register_filesystem() fails, vxfs_inode cache must be destroyed.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 fs/freevxfs/vxfs_super.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

--- a/fs/freevxfs/vxfs_super.c
+++ b/fs/freevxfs/vxfs_super.c
@@ -260,12 +260,17 @@ static struct file_system_type vxfs_fs_t
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] freevxfs: fix leak on error path
  2006-08-25  1:03 [PATCH] freevxfs: fix leak on error path Alexey Dobriyan
@ 2006-08-25  6:13 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2006-08-25  6:13 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: Andrew Morton, linux-fsdevel, Christoph Hellwig

On Fri, Aug 25, 2006 at 05:03:12AM +0400, Alexey Dobriyan wrote:
> If register_filesystem() fails, vxfs_inode cache must be destroyed.

ok.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-08-25  6:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-25  1:03 [PATCH] freevxfs: fix leak on error path Alexey Dobriyan
2006-08-25  6:13 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).