aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2016-05-19 15:19:27 +0200
committerMichael S. Tsirkin <mst@redhat.com>2016-06-07 15:39:27 +0300
commit8cc87c3179f3988cf870ae4e637123770bdf82f1 (patch)
treeb32a80ded84355d4921b1326c4d3a55ef5e4a3a7
parentad9671b8700ac491564d964f79ee9d1f106756ae (diff)
acpi: cleanup bios_linker_loader_cleanup()
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 <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/acpi/aml-build.c3
-rw-r--r--hw/acpi/bios-linker-loader.c8
-rw-r--r--include/hw/acpi/bios-linker-loader.h2
3 files changed, 6 insertions, 7 deletions
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index bff259955e..66e9bf8f06 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1548,8 +1548,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 8e3f30df48..b67da68e5f 100644
--- a/hw/acpi/bios-linker-loader.c
+++ b/hw/acpi/bios-linker-loader.c
@@ -121,12 +121,13 @@ BIOSLinker *bios_linker_loader_init(void)
return linker;
}
-/* Free linker wrapper and return the linker commands array. */
-void *bios_linker_loader_cleanup(BIOSLinker *linker)
+/* Free linker wrapper */
+void bios_linker_loader_cleanup(BIOSLinker *linker)
{
int i;
BiosLinkerFileEntry *entry;
- void *cmd_blob = g_array_free(linker->cmd_blob, false);
+
+ g_array_free(linker->cmd_blob, true);
for (i = 0; i < linker->file_list->len; i++) {
entry = &g_array_index(linker->file_list, BiosLinkerFileEntry, i);
@@ -134,7 +135,6 @@ void *bios_linker_loader_cleanup(BIOSLinker *linker)
}
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 bee6deee02..564e192c16 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