[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/6] acpi: cleanup bios_linker_loader_cleanup()
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 3/6] acpi: cleanup bios_linker_loader_cleanup() |
Date: |
Mon, 7 Mar 2016 16:19:05 +0100 |
bios_linker_loader_cleanup() is called only from one place
and returned value is immediately freed wich makes returning
pointer from bios_linker_loader_cleanup() useless.
Cleanup bios_linker_loader_cleanup() by freeing
data there so that caller won't have to free it.
Signed-off-by: Igor Mammedov <address@hidden>
---
hw/acpi/aml-build.c | 3 +--
hw/acpi/bios-linker-loader.c | 6 ++----
include/hw/acpi/bios-linker-loader.h | 2 +-
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index aad4b8a..f72b5ef 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1482,8 +1482,7 @@ void acpi_build_tables_init(AcpiBuildTables *tables)
void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre)
{
- void *linker_data = bios_linker_loader_cleanup(tables->linker);
- g_free(linker_data);
+ bios_linker_loader_cleanup(tables->linker);
g_array_free(tables->rsdp, true);
g_array_free(tables->table_data, true);
g_array_free(tables->tcpalog, mfre);
diff --git a/hw/acpi/bios-linker-loader.c b/hw/acpi/bios-linker-loader.c
index 873e61c..a2aeb66 100644
--- a/hw/acpi/bios-linker-loader.c
+++ b/hw/acpi/bios-linker-loader.c
@@ -129,13 +129,11 @@ BIOSLinker *bios_linker_loader_init(void)
}
/* Free linker wrapper and return the linker commands array. */
-void *bios_linker_loader_cleanup(BIOSLinker *linker)
+void bios_linker_loader_cleanup(BIOSLinker *linker)
{
- void *cmd_blob = g_array_free(linker->cmd_blob, false);
-
+ g_array_free(linker->cmd_blob, true);
g_array_free(linker->file_list, true);
g_free(linker);
- return cmd_blob;
}
static const BiosLinkerFileEntry *
diff --git a/include/hw/acpi/bios-linker-loader.h
b/include/hw/acpi/bios-linker-loader.h
index bee6dee..564e192 100644
--- a/include/hw/acpi/bios-linker-loader.h
+++ b/include/hw/acpi/bios-linker-loader.h
@@ -26,5 +26,5 @@ void bios_linker_loader_add_pointer(BIOSLinker *linker,
void *pointer,
uint8_t pointer_size);
-void *bios_linker_loader_cleanup(BIOSLinker *linker);
+void bios_linker_loader_cleanup(BIOSLinker *linker);
#endif
--
1.8.3.1
- [Qemu-devel] [PATCH 0/6] acpi: simplify bios_linker API, Igor Mammedov, 2016/03/07
- [Qemu-devel] [PATCH 1/6] acpi: convert linker from GArray to BOISLinker structure, Igor Mammedov, 2016/03/07
- [Qemu-devel] [PATCH 3/6] acpi: cleanup bios_linker_loader_cleanup(),
Igor Mammedov <=
- [Qemu-devel] [PATCH 4/6] tpm: apci: cleanup TCPA table initialization, Igor Mammedov, 2016/03/07
- [Qemu-devel] [PATCH 2/6] acpi: simplify bios_linker API by removing redundant 'table' argument, Igor Mammedov, 2016/03/07
- [Qemu-devel] [PATCH 6/6] acpi: make bios_linker_loader_add_checksum() API offset based, Igor Mammedov, 2016/03/07
- [Qemu-devel] [PATCH 5/6] acpi: make bios_linker_loader_add_pointer() API offset based, Igor Mammedov, 2016/03/07
- Re: [Qemu-devel] [PATCH 0/6] acpi: simplify bios_linker API, Michael S. Tsirkin, 2016/03/07