wistron_btns: fix a memory leak in wb_module_init error path
Subsystems (3)
PATCH 1/1 wistron_btns: fix a memory leak in wb_module_init error path
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 <[email protected]>
--- drivers/input/misc/wistron_btns.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/input/misc/wistron_btns.c +1 -0
@@ -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; }
Signature · 1 line
1.5.4.3
Dmitry Torokhov
maintainerHi Axel,
Quoted 13 lines · Axel Lin
select_keymapcallscopy_keymapto allocate a memory for keymap. This patch adds a missing kfree(keymap) inwb_module_initerror path.Signed-off-by Axel Lin <[email protected]>--- drivers/input/misc/wistron_btns.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)drivers/input/misc/wistron_btns.c +0
-0
drivers/input/misc/wistron_btns.c static int __init wb_module_init(void) · line 1374
Quoted 4 lines
drivers/input/misc/wistron_btns.c +1
-0@@ -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.
Signature · 1 line
Dmitry