[Lguest] [PATCH 2.6.28] lguest: LCA09 lguest tutorial - fix memory leak in close()
Rusty Russell
rusty at rustcorp.com.au
Sun Jan 25 23:28:32 EST 2009
On Thursday 22 January 2009 13:41:28 Mark Wallis wrote:
> From Rusty's tutorial, fix the memory leak in close() by using kfree instead of just zeroing the memory.
>
> Signed-off-by: Mark Wallis <lguest at markwallis.id.au>
Hi Mark,
A couple of points: the patch should be applicable with -p1, so this is
one directory too low.
> --- 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
And some whitespace damage has been done (tabs to spaces, spaces missing?)
> @@ -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);
>
Cheers,
Rusty.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/lguest/attachments/20090125/9d8c0208/attachment.htm>
More information about the Lguest
mailing list