acer-wmi: fix memory leaks in wmab_execute error path
authorAxel Lin <axel.lin@gmail.com>
Tue, 20 Jul 2010 22:19:53 +0000 (15:19 -0700)
committerMatthew Garrett <mjg@redhat.com>
Tue, 3 Aug 2010 13:49:04 +0000 (09:49 -0400)
commit7677fbdff16f5b817bc3dc5d194a8b3350f8f9cb
tree2086eff81fa49d9b9a5ab569a7b867f30c7d24d6
parent669048639ca6d3fdfb2e75dd77b8f49434d57625
acer-wmi: fix memory leaks in wmab_execute error path

When acpi_evaluate_object() is passed ACPI_ALLOCATE_BUFFER, the caller
must kfree the returned buffer if AE_OK is returned.

Call Trace:
wmab_execute
  -> wmi_evaluate_method
    -> acpi_evaluate_object

Thus if callers of wmab_execute() pass ACPI_ALLOCATE_BUFFER, the return
buffer must be kfreed if wmab_execute return AE_OK.

[akpm@linux-foundation.org: avoid multiple return points, remove unneeded cast, remove unneeded initialisation of `status']
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Thomas Renninger <trenn@suse.de>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
drivers/platform/x86/acer-wmi.c