(sorry if this is received twice)

From Rusty's tutorial, fix the memory leak in close() by using kfree instead of 
just zeroing the memory.

Signed-off-by: Mark Wallis <lgu...@markwallis.id.au>

--- drivers/lguest/lguest_user.c.orig   2009-01-22 10:20:33.000000000 +1100
+++ drivers/lguest/lguest_user.c        2009-01-22 10:55:57.000000000 +1100
@@ -310,9 +310,8 @@
         * 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);


_______________________________________________
Lguest mailing list
Lguest@ozlabs.org
https://ozlabs.org/mailman/listinfo/lguest

Reply via email to