summaryrefslogtreecommitdiff
path: root/drivers/lguest/lguest_user.c
diff options
context:
space:
mode:
authorMark Wallis <mwallis@serialmonkey.com>2009-01-26 09:32:35 +0300
committerRusty Russell <rusty@rustcorp.com.au>2009-01-30 04:04:11 +0300
commit05dfdbbd678ea2b642db73f48b75667a23d15484 (patch)
tree63d4cbf36a1fdf11e77008bd169d02446469cc8b /drivers/lguest/lguest_user.c
parentb44d49ab0954accefba4c71274ab58abe1c25c52 (diff)
downloadlinux-05dfdbbd678ea2b642db73f48b75667a23d15484.tar.xz
lguest: Fix a memory leak with the lg object during launcher close
Fix a memory leak identified by Rusty Russell during LCA09 by kfree'ing the lg object instead of just clearing it when the launcher closes. Signed-off-by: Mark Wallis <mwallis@serialmonkey.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/lguest_user.c')
-rw-r--r--drivers/lguest/lguest_user.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index 34bc017b8b3c..b8ee103eed5f 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -307,9 +307,8 @@ static int close(struct inode *inode, struct file *file)
* kmalloc()ed string, either of which is ok to hand to kfree(). */
if (!IS_ERR(lg->dead))
kfree(lg->dead);
- /* We clear the entire structure, which also marks it as free for the
- * next user. */
- memset(lg, 0, sizeof(*lg));
+ /* Free the memory allocated to the lguest_struct */
+ kfree(lg);
/* Release lock and exit. */
mutex_unlock(&lguest_lock);