提交 32ab72e7 编写于 作者: A Axel Lin 提交者: Matthew Garrett

dell-wmi: fix a memory leak

If dell_new_hk_type is true, dell_legacy_wmi_keymap will point to a memory
allocated in setup_new_hk_map().
In this case, the memory is not freed in current implementation.
This patch fixes the leak by kfree(dell_wmi_keymap) if dell_new_hk_type is true.
Signed-off-by: NAxel Lin <axel.lin@gmail.com>
Signed-off-by: NMatthew Garrett <mjg@redhat.com>
上级 d53bf0f3
......@@ -339,13 +339,18 @@ static int __init dell_wmi_init(void)
acpi_video = acpi_video_backlight_support();
err = dell_wmi_input_setup();
if (err)
if (err) {
if (dell_new_hk_type)
kfree(dell_wmi_keymap);
return err;
}
status = wmi_install_notify_handler(DELL_EVENT_GUID,
dell_wmi_notify, NULL);
if (ACPI_FAILURE(status)) {
input_unregister_device(dell_wmi_input_dev);
if (dell_new_hk_type)
kfree(dell_wmi_keymap);
printk(KERN_ERR
"dell-wmi: Unable to register notify handler - %d\n",
status);
......@@ -359,6 +364,8 @@ static void __exit dell_wmi_exit(void)
{
wmi_remove_notify_handler(DELL_EVENT_GUID);
input_unregister_device(dell_wmi_input_dev);
if (dell_new_hk_type)
kfree(dell_wmi_keymap);
}
module_init(dell_wmi_init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册