ACPICA: Fix possible memory leak for Scope ASL operator

Using Scope(\) to change the scope to the root could cause a
single object memory leak.

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Lin Ming 2009-10-13 10:34:56 +08:00 committed by Len Brown
parent 74d3ec77a5
commit 50b77eda9b

View File

@ -639,26 +639,42 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
break; break;
case AML_SCOPE_OP: case AML_SCOPE_OP:
/*
* The Path is an object reference to an existing object. /* Special case for Scope(\) -> refers to the Root node */
* Don't enter the name into the namespace, but look it up
* for use later. if (op && (op->named.node == acpi_gbl_root_node)) {
*/ node = op->named.node;
status =
acpi_ns_lookup(walk_state->scope_info, buffer_ptr, status =
object_type, ACPI_IMODE_EXECUTE, acpi_ds_scope_stack_push(node, object_type,
ACPI_NS_SEARCH_PARENT, walk_state, &(node)); walk_state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
#ifdef ACPI_ASL_COMPILER return_ACPI_STATUS(status);
if (status == AE_NOT_FOUND) {
status = AE_OK;
} else {
ACPI_ERROR_NAMESPACE(buffer_ptr, status);
} }
} else {
/*
* The Path is an object reference to an existing object.
* Don't enter the name into the namespace, but look it up
* for use later.
*/
status =
acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
object_type, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state,
&(node));
if (ACPI_FAILURE(status)) {
#ifdef ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) {
status = AE_OK;
} else {
ACPI_ERROR_NAMESPACE(buffer_ptr,
status);
}
#else #else
ACPI_ERROR_NAMESPACE(buffer_ptr, status); ACPI_ERROR_NAMESPACE(buffer_ptr, status);
#endif #endif
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
}
} }
/* /*