[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 25/29] hw/i386/acpi-build.c: Fix memory leak in acpi_
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 25/29] hw/i386/acpi-build.c: Fix memory leak in acpi_build_tables_cleanup() |
Date: |
Mon, 3 Nov 2014 14:46:04 +0200 |
From: Nikita Belov <address@hidden>
There are three ACPI tables: 'linker_data', 'rsdp' and 'table_data'. They are
used differently. Two of them are being copied before using and only the copy
is used later. But the third is used directly. Because of that we need to free
two tables completely and delete only wrapper for the third one.
Valgrind output:
==23931== 131,072 bytes in 1 blocks are definitely lost in loss record 7,729 of
7,734
==23931== at 0x4C2CE8E: realloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23931== by 0x2EA920: realloc_and_trace (vl.c:2811)
==23931== by 0x509E6AE: g_realloc (in
/lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
==23931== by 0x506DB32: ??? (in
/lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
==23931== by 0x506E463: g_array_set_size (in
/lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
==23931== by 0x256A4F: acpi_align_size (acpi-build.c:487)
==23931== by 0x259F92: acpi_build (acpi-build.c:1601)
==23931== by 0x25A212: acpi_setup (acpi-build.c:1682)
==23931== by 0x24F346: pc_guest_info_machine_done (pc.c:1110)
==23931== by 0x55FAAB: notifier_list_notify (notify.c:39)
==23931== by 0x2EA704: qemu_run_machine_init_done_notifiers (vl.c:2759)
==23931== by 0x2EEC3C: main (vl.c:4504)
Signed-off-by: Nikita Belov <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Acked-by: Christian Borntraeger <address@hidden>
---
hw/i386/acpi-build.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 6bd2749..4003b6b 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1502,11 +1502,9 @@ static inline void
acpi_build_tables_init(AcpiBuildTables *tables)
static inline void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool
mfre)
{
void *linker_data = bios_linker_loader_cleanup(tables->linker);
- if (mfre) {
- g_free(linker_data);
- }
+ g_free(linker_data);
g_array_free(tables->rsdp, mfre);
- g_array_free(tables->table_data, mfre);
+ g_array_free(tables->table_data, true);
g_array_free(tables->tcpalog, mfre);
}
--
MST
- [Qemu-devel] [PULL 16/29] qom/cpu: remove the unused CPU hot-plug notifier, (continued)
- [Qemu-devel] [PULL 16/29] qom/cpu: remove the unused CPU hot-plug notifier, Michael S. Tsirkin, 2014/11/03
- [Qemu-devel] [PULL 17/29] cpu-hotplug: rename function for better readability, Michael S. Tsirkin, 2014/11/03
- [Qemu-devel] [PULL 18/29] acpi/cpu-hotplug: introduce helper function to keep bit setting in one place, Michael S. Tsirkin, 2014/11/03
- [Qemu-devel] [PULL 19/29] -machine vmport=off: Allow disabling of VMWare ioport emulation, Michael S. Tsirkin, 2014/11/03
- [Qemu-devel] [PULL 20/29] hw/pci: fixed error flow in pci_qdev_init, Michael S. Tsirkin, 2014/11/03
- [Qemu-devel] [PULL 21/29] hw/pci: fixed hotplug crash when using rombar=0 with devices having romfile, Michael S. Tsirkin, 2014/11/03
- [Qemu-devel] [PULL 22/29] hw/virtio/vring/event_idx: fix the vring_avail_event error, Michael S. Tsirkin, 2014/11/03
- [Qemu-devel] [PULL 23/29] pc: Add pc_compat_2_1() function, Michael S. Tsirkin, 2014/11/03
- [Qemu-devel] [PULL 24/29] smbios: Encode UUID according to SMBIOS specification, Michael S. Tsirkin, 2014/11/03
- [Qemu-devel] [PULL 26/29] qemu-char: fix tcp_get_fds, Michael S. Tsirkin, 2014/11/03
- [Qemu-devel] [PULL 25/29] hw/i386/acpi-build.c: Fix memory leak in acpi_build_tables_cleanup(),
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 28/29] vga: add default display to machine class, Michael S. Tsirkin, 2014/11/03
- [Qemu-devel] [PULL 29/29] vga: flip qemu 2.2 pc machine types from cirrus to stdvga, Michael S. Tsirkin, 2014/11/03
- [Qemu-devel] [PULL 27/29] vhost-user: fix mmap offset calculation, Michael S. Tsirkin, 2014/11/03