From 74570d413cbb5cede06a0183a91d3006f134bf6b Mon Sep 17 00:00:00 2001 From: Kimball Murray Date: Sun, 29 Jan 2006 21:50:59 -0500 Subject: Input: mousedev - fix memory leak Apparently, "while true; do cat /dev/input/mice; done" causes an OOM in a short amount of time. Funny that nobody noticed, it actually is very easy to trigger just by switching between VT1 and VT7... Signed-off-by: Pete Zaitcev Signed-off-by: Dmitry Torokhov --- drivers/input/mousedev.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/input/mousedev.c') diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 81fd7a97a93..9abed18d2ec 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -356,7 +356,7 @@ static void mousedev_free(struct mousedev *mousedev) kfree(mousedev); } -static int mixdev_release(void) +static void mixdev_release(void) { struct input_handle *handle; @@ -370,8 +370,6 @@ static int mixdev_release(void) mousedev_free(mousedev); } } - - return 0; } static int mousedev_release(struct inode * inode, struct file * file) @@ -384,9 +382,8 @@ static int mousedev_release(struct inode * inode, struct file * file) if (!--list->mousedev->open) { if (list->mousedev->minor == MOUSEDEV_MIX) - return mixdev_release(); - - if (!mousedev_mix.open) { + mixdev_release(); + else if (!mousedev_mix.open) { if (list->mousedev->exist) input_close_device(&list->mousedev->handle); else -- cgit v1.2.3