ACPI / utils: Fix memory leak in acpi_evaluate_reference() error path

When package.count is larger than ACPI_MAX_HANDLES, buffer.pointer is
not freed before the function returns AE_NO_MEMORY. Fix this possible
memory leak by kfree'ing it.

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Xiongfeng Wang 2017-11-09 14:22:39 +08:00 committed by Rafael J. Wysocki
parent 04ed510988
commit 09e1508693
1 changed files with 1 additions and 0 deletions

View File

@ -355,6 +355,7 @@ acpi_evaluate_reference(acpi_handle handle,
}
if (package->package.count > ACPI_MAX_HANDLES) {
kfree(package);
return AE_NO_MEMORY;
}
list->count = package->package.count;