Skip to contentSkip to conversation

acpi: memory leak in acpi_evaluate_integer()

PATCH In review [email protected] 1 participant 1 message Apr 27, 2006 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 11/16 acpi: memory leak in acpi_evaluate_integer()

From: Vasily Averin <[email protected]>

acpi_evaluate_integer() does not release allocated memory on the error path.

(akpm: this is what happens when one uses multiple `return' statements...)

---

 drivers/acpi/utils.c |    2 ++
 1 files changed, 2 insertions(+)
drivers/acpi/utils.c renamed from drivers/acpi/utils.c~memory-leak-in-acpi_evaluate_integer +2 -0
diff -puN drivers/acpi/utils.c~memory-leak-in-acpi_evaluate_integer drivers/acpi/utils.c
@@ -274,11 +274,13 @@ acpi_evaluate_integer(acpi_handle handle
 	status = acpi_evaluate_object(handle, pathname, arguments, &buffer);
 	if (ACPI_FAILURE(status)) {
 		acpi_util_eval_error(handle, pathname, status);
+		kfree(element);
 		return_ACPI_STATUS(status);
 	}
 
 	if (element->type != ACPI_TYPE_INTEGER) {
 		acpi_util_eval_error(handle, pathname, AE_BAD_DATA);
+		kfree(element);
 		return_ACPI_STATUS(AE_BAD_DATA);
 	}
 

_