From: Lin Ming Date: Sat, 27 Sep 2008 03:29:57 +0000 (+0800) Subject: ACPICA: Fix possible memory leak, error exit path X-Git-Tag: v2.6.28-rc1~26^2~26^2~6 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=cf058bd1c84df9921ecc517d8a8a413f4d6b5b45;p=linux-2.6-omap-h63xx.git ACPICA: Fix possible memory leak, error exit path Fixed two possible memory leaks in the error exit paths of acpi_ut_update_objerct_reference() and acpi_ut_walk_package_tree() These functions are similar in that they use a stack of state objects in order to eliminate recursion. The stack must be fully deallocated if an error occurs. http://www.acpica.org/bugzilla/show_bug.cgi?id=383 Signed-off-by: Lin Ming Signed-off-by: Bob Moore Signed-off-by: Len Brown --- diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 5c219758c22..d197c6b29e1 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -585,6 +585,13 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) ACPI_EXCEPTION((AE_INFO, status, "Could not update object reference count")); + /* Free any stacked Update State objects */ + + while (state_list) { + state = acpi_ut_pop_generic_state(&state_list); + acpi_ut_delete_generic_state(state); + } + return_ACPI_STATUS(status); } diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index f34be677355..9089a158a87 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -995,6 +995,15 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, state->pkg. this_target_obj, 0); if (!state) { + + /* Free any stacked Update State objects */ + + while (state_list) { + state = + acpi_ut_pop_generic_state + (&state_list); + acpi_ut_delete_generic_state(state); + } return_ACPI_STATUS(AE_NO_MEMORY); } }