ACPICA: Fix a couple memory leaks during package object resolution

ACPICA commit 69d4415360446b4a1826dab76ba0cd6d24710ddd

A couple memory leaks during resolution of individual
package elements.

Link: https://github.com/acpica/acpica/commit/69d44153
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Bob Moore 2018-01-03 15:06:29 -08:00 committed by Rafael J. Wysocki
parent bc4d413a81
commit e7b2005c60

View File

@ -297,8 +297,10 @@ acpi_ds_init_package_element(u8 object_type,
{
union acpi_operand_object **element_ptr;
ACPI_FUNCTION_TRACE(ds_init_package_element);
if (!source_object) {
return (AE_OK);
return_ACPI_STATUS(AE_OK);
}
/*
@ -329,7 +331,7 @@ acpi_ds_init_package_element(u8 object_type,
source_object->package.flags |= AOPOBJ_DATA_VALID;
}
return (AE_OK);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
@ -352,6 +354,7 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
union acpi_generic_state scope_info;
union acpi_operand_object *element = *element_ptr;
struct acpi_namespace_node *resolved_node;
struct acpi_namespace_node *original_node;
char *external_path = NULL;
acpi_object_type type;
@ -441,6 +444,7 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
* will remain as named references. This behavior is not described
* in the ACPI spec, but it appears to be an oversight.
*/
original_node = resolved_node;
status = acpi_ex_resolve_node_to_value(&resolved_node, NULL);
if (ACPI_FAILURE(status)) {
return_VOID;
@ -468,26 +472,27 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
*/
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_THERMAL:
/* TBD: This may not be necesssary */
acpi_ut_add_reference(resolved_node->object);
case ACPI_TYPE_METHOD:
break;
case ACPI_TYPE_MUTEX:
case ACPI_TYPE_METHOD:
case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_EVENT:
case ACPI_TYPE_REGION:
/* acpi_ex_resolve_node_to_value gave these an extra reference */
acpi_ut_remove_reference(original_node->object);
break;
default:
/*
* For all other types - the node was resolved to an actual
* operand object with a value, return the object
* operand object with a value, return the object. Remove
* a reference on the existing object.
*/
acpi_ut_remove_reference(element);
*element_ptr = (union acpi_operand_object *)resolved_node;
break;
}