From 09e15086936e01d7588020be37ea724116bcefec Mon Sep 17 00:00:00 2001 From: Xiongfeng Wang Date: Thu, 9 Nov 2017 14:22:39 +0800 Subject: [PATCH] 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 Signed-off-by: Rafael J. Wysocki --- drivers/acpi/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 0a9e5979aaa9..9d49a1acebe3 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -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; -- GitLab