lguest_user.c: fix memory leak
authorAdrian Bunk <bunk@kernel.org>
Thu, 15 Nov 2007 00:59:00 +0000 (16:59 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 15 Nov 2007 02:45:38 +0000 (18:45 -0800)
This patch fixes a memory leak spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/lguest/lguest_user.c

index 9d716fa42cad39f00dc2e20cdc364c752679409e..3b92a61ba8d23b14e1ac8e5b342929a314b669be 100644 (file)
@@ -184,7 +184,7 @@ static int initialize(struct file *file, const unsigned long __user *input)
 free_regs:
        free_page(lg->regs_page);
 release_guest:
-       memset(lg, 0, sizeof(*lg));
+       kfree(lg);
 unlock:
        mutex_unlock(&lguest_lock);
        return err;