diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-06-30 05:25:46 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2010-08-03 09:48:53 -0400 |
commit | 32ab72e7ca7aed399b81a3ffec26d7353bd33581 (patch) | |
tree | 4501e686520ee8fc710d1151b29aad68669d5342 /drivers/platform | |
parent | d53bf0f32410c8c738935aa3d9740d66d39ba967 (diff) |
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: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/dell-wmi.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c index 12a8e6fa1d56..08fb70f6d9bf 100644 --- a/drivers/platform/x86/dell-wmi.c +++ b/drivers/platform/x86/dell-wmi.c | |||
@@ -339,13 +339,18 @@ static int __init dell_wmi_init(void) | |||
339 | acpi_video = acpi_video_backlight_support(); | 339 | acpi_video = acpi_video_backlight_support(); |
340 | 340 | ||
341 | err = dell_wmi_input_setup(); | 341 | err = dell_wmi_input_setup(); |
342 | if (err) | 342 | if (err) { |
343 | if (dell_new_hk_type) | ||
344 | kfree(dell_wmi_keymap); | ||
343 | return err; | 345 | return err; |
346 | } | ||
344 | 347 | ||
345 | status = wmi_install_notify_handler(DELL_EVENT_GUID, | 348 | status = wmi_install_notify_handler(DELL_EVENT_GUID, |
346 | dell_wmi_notify, NULL); | 349 | dell_wmi_notify, NULL); |
347 | if (ACPI_FAILURE(status)) { | 350 | if (ACPI_FAILURE(status)) { |
348 | input_unregister_device(dell_wmi_input_dev); | 351 | input_unregister_device(dell_wmi_input_dev); |
352 | if (dell_new_hk_type) | ||
353 | kfree(dell_wmi_keymap); | ||
349 | printk(KERN_ERR | 354 | printk(KERN_ERR |
350 | "dell-wmi: Unable to register notify handler - %d\n", | 355 | "dell-wmi: Unable to register notify handler - %d\n", |
351 | status); | 356 | status); |
@@ -359,6 +364,8 @@ static void __exit dell_wmi_exit(void) | |||
359 | { | 364 | { |
360 | wmi_remove_notify_handler(DELL_EVENT_GUID); | 365 | wmi_remove_notify_handler(DELL_EVENT_GUID); |
361 | input_unregister_device(dell_wmi_input_dev); | 366 | input_unregister_device(dell_wmi_input_dev); |
367 | if (dell_new_hk_type) | ||
368 | kfree(dell_wmi_keymap); | ||
362 | } | 369 | } |
363 | 370 | ||
364 | module_init(dell_wmi_init); | 371 | module_init(dell_wmi_init); |