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>
This commit is contained in:
parent
b44d49ab09
commit
05dfdbbd67
|
@ -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(). */
|
* kmalloc()ed string, either of which is ok to hand to kfree(). */
|
||||||
if (!IS_ERR(lg->dead))
|
if (!IS_ERR(lg->dead))
|
||||||
kfree(lg->dead);
|
kfree(lg->dead);
|
||||||
/* We clear the entire structure, which also marks it as free for the
|
/* Free the memory allocated to the lguest_struct */
|
||||||
* next user. */
|
kfree(lg);
|
||||||
memset(lg, 0, sizeof(*lg));
|
|
||||||
/* Release lock and exit. */
|
/* Release lock and exit. */
|
||||||
mutex_unlock(&lguest_lock);
|
mutex_unlock(&lguest_lock);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue