From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9Y0B-0003Ft-2X for qemu-devel@nongnu.org; Sun, 05 Jun 2016 09:22:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9Y03-00050T-SZ for qemu-devel@nongnu.org; Sun, 05 Jun 2016 09:22:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35951) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9Y03-00050M-Mq for qemu-devel@nongnu.org; Sun, 05 Jun 2016 09:21:55 -0400 Date: Sun, 5 Jun 2016 16:21:53 +0300 From: "Michael S. Tsirkin" Message-ID: <1465132825-14242-20-git-send-email-mst@redhat.com> References: <1465132825-14242-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1465132825-14242-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 19/25] acpi: cleanup bios_linker_loader_cleanup() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov From: Igor Mammedov 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/bios-linker-loader.h | 2 +- hw/acpi/aml-build.c | 3 +-- hw/acpi/bios-linker-loader.c | 8 +++----- 3 files changed, 5 insertions(+), 8 deletions(-) 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 diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index bff2599..66e9bf8 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 a2f20ec..7a2e4d2 100644 --- a/hw/acpi/bios-linker-loader.c +++ b/hw/acpi/bios-linker-loader.c @@ -128,14 +128,12 @@ 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) { - 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 * -- MST