* [PATCH] wistron_btns: fix a memory leak in wb_module_init error path
@ 2010-06-28 6:30 Axel Lin
2010-06-28 8:02 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2010-06-28 6:30 UTC (permalink / raw)
To: linux-kernel
Cc: Miloslav Trmac, Dmitry Torokhov, Rakib Mullick, TJ, Julia Lawall,
Samu Onkalo, linux-input
select_keymap calls copy_keymap to allocate a memory for keymap.
This patch adds a missing kfree(keymap) in wb_module_init error path.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/input/misc/wistron_btns.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index 4dac8b7..55ce70e 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -1371,6 +1371,7 @@ static int __init wb_module_init(void)
platform_driver_unregister(&wistron_driver);
err_unmap_bios:
unmap_bios();
+ kfree(keymap);
return err;
}
--
1.5.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wistron_btns: fix a memory leak in wb_module_init error path
2010-06-28 6:30 [PATCH] wistron_btns: fix a memory leak in wb_module_init error path Axel Lin
@ 2010-06-28 8:02 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2010-06-28 8:02 UTC (permalink / raw)
To: Axel Lin
Cc: linux-kernel, Miloslav Trmac, Rakib Mullick, TJ, Julia Lawall,
Samu Onkalo, linux-input
Hi Axel,
On Mon, Jun 28, 2010 at 02:30:20PM +0800, Axel Lin wrote:
> select_keymap calls copy_keymap to allocate a memory for keymap.
> This patch adds a missing kfree(keymap) in wb_module_init error path.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> drivers/input/misc/wistron_btns.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
> index 4dac8b7..55ce70e 100644
> --- a/drivers/input/misc/wistron_btns.c
> +++ b/drivers/input/misc/wistron_btns.c
> @@ -1371,6 +1371,7 @@ static int __init wb_module_init(void)
> platform_driver_unregister(&wistron_driver);
> err_unmap_bios:
> unmap_bios();
> + kfree(keymap);
Thank you for the patch, however this is not quite enough - we also need
to free keymap when map_bios() call fails instead of returning
immediately.
I fixed up locally and applied the patch.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-06-28 8:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-28 6:30 [PATCH] wistron_btns: fix a memory leak in wb_module_init error path Axel Lin
2010-06-28 8:02 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).