summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/wmi.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-06-03 05:45:45 +0200
committerMatthew Garrett <mjg@redhat.com>2010-08-03 15:48:49 +0200
commita5167c5b3a842b865b0ca87202b95cc8a84c9e7e (patch)
tree306e318b77177938973b4f98a38c5e5a3482c7bc /drivers/platform/x86/wmi.c
parentdell-laptop: Add another Dell laptop family to the DMI whitelist (diff)
downloadlinux-a5167c5b3a842b865b0ca87202b95cc8a84c9e7e.tar.xz
linux-a5167c5b3a842b865b0ca87202b95cc8a84c9e7e.zip
wmi: fix memory leak in parse_wdg
This patch properly kfree out.pointer and gblock in error path. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86/wmi.c')
-rw-r--r--drivers/platform/x86/wmi.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index e4eaa14ed987..582b5cdd3f43 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -827,8 +827,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)
total = obj->buffer.length / sizeof(struct guid_block);
gblock = kmemdup(obj->buffer.pointer, obj->buffer.length, GFP_KERNEL);
- if (!gblock)
- return AE_NO_MEMORY;
+ if (!gblock) {
+ status = AE_NO_MEMORY;
+ goto out_free_pointer;
+ }
for (i = 0; i < total; i++) {
/*
@@ -848,8 +850,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)
wmi_dump_wdg(&gblock[i]);
wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL);
- if (!wblock)
- return AE_NO_MEMORY;
+ if (!wblock) {
+ status = AE_NO_MEMORY;
+ goto out_free_gblock;
+ }
wblock->gblock = gblock[i];
wblock->handle = handle;
@@ -860,8 +864,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)
list_add_tail(&wblock->list, &wmi_blocks.list);
}
- kfree(out.pointer);
+out_free_gblock:
kfree(gblock);
+out_free_pointer:
+ kfree(out.pointer);
return status;
}