aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi/executer/exconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exconfig.c')
-rw-r--r--drivers/acpi/executer/exconfig.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
index 734b2f24af4..8bfa6effaa0 100644
--- a/drivers/acpi/executer/exconfig.c
+++ b/drivers/acpi/executer/exconfig.c
@@ -376,16 +376,22 @@ acpi_ex_load_op (
*/
status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc);
if (ACPI_FAILURE (status)) {
- goto cleanup;
+ return_ACPI_STATUS (status);
}
table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
buffer_desc->buffer.pointer);
- /* Sanity check the table length */
+ /* All done with the buffer_desc, delete it */
+
+ buffer_desc->buffer.pointer = NULL;
+ acpi_ut_remove_reference (buffer_desc);
+
+ /* Sanity check the table length */
if (table_ptr->length < sizeof (struct acpi_table_header)) {
- return_ACPI_STATUS (AE_BAD_HEADER);
+ status = AE_BAD_HEADER;
+ goto cleanup;
}
break;
@@ -413,7 +419,9 @@ acpi_ex_load_op (
status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle);
if (ACPI_FAILURE (status)) {
- goto cleanup;
+ /* On error, table_ptr was deallocated above */
+
+ return_ACPI_STATUS (status);
}
/* Store the ddb_handle into the Target operand */
@@ -421,17 +429,14 @@ acpi_ex_load_op (
status = acpi_ex_store (ddb_handle, target, walk_state);
if (ACPI_FAILURE (status)) {
(void) acpi_ex_unload_table (ddb_handle);
- }
- return_ACPI_STATUS (status);
+ /* table_ptr was deallocated above */
+ return_ACPI_STATUS (status);
+ }
cleanup:
-
- if (buffer_desc) {
- acpi_ut_remove_reference (buffer_desc);
- }
- else {
+ if (ACPI_FAILURE (status)) {
ACPI_MEM_FREE (table_ptr);
}
return_ACPI_STATUS (status);