Re: [PATCH] wistron_btns: fix a memory leak in wb_module_init error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> ---
>  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
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux