[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.2.2 21/60] hw/riscv/virt-acpi-build.c: fix leak in build_rhct(
From: |
Michael Tokarev |
Subject: |
[Stable-8.2.2 21/60] hw/riscv/virt-acpi-build.c: fix leak in build_rhct() |
Date: |
Wed, 21 Feb 2024 11:20:09 +0300 |
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
The 'isa' char pointer isn't being freed after use.
Issue detected by Valgrind:
==38752== 128 bytes in 1 blocks are definitely lost in loss record 3,190 of
3,884
==38752== at 0x484280F: malloc (vg_replace_malloc.c:442)
==38752== by 0x5189619: g_malloc (gmem.c:130)
==38752== by 0x51A5BF2: g_strconcat (gstrfuncs.c:628)
==38752== by 0x6C1E3E: riscv_isa_string_ext (cpu.c:2321)
==38752== by 0x6C1E3E: riscv_isa_string (cpu.c:2343)
==38752== by 0x6BD2EA: build_rhct (virt-acpi-build.c:232)
==38752== by 0x6BD2EA: virt_acpi_build (virt-acpi-build.c:556)
==38752== by 0x6BDC86: virt_acpi_setup (virt-acpi-build.c:662)
==38752== by 0x9C8DC6: notifier_list_notify (notify.c:39)
==38752== by 0x4A595A: qdev_machine_creation_done (machine.c:1589)
==38752== by 0x61E052: qemu_machine_creation_done (vl.c:2680)
==38752== by 0x61E052: qmp_x_exit_preconfig.part.0 (vl.c:2709)
==38752== by 0x6220C6: qmp_x_exit_preconfig (vl.c:2702)
==38752== by 0x6220C6: qemu_init (vl.c:3758)
==38752== by 0x425858: main (main.c:47)
Fixes: ebfd392893 ("hw/riscv/virt: virt-acpi-build.c: Add RHCT Table")
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20240122221529.86562-2-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit 1a49762c07d001ce291e4fc6773317f5611af3a4)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: context fixup)
diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c
index 7331248f59..171d56a6ad 100644
--- a/hw/riscv/virt-acpi-build.c
+++ b/hw/riscv/virt-acpi-build.c
@@ -132,7 +132,7 @@ static void build_rhct(GArray *table_data,
size_t len, aligned_len;
uint32_t isa_offset, num_rhct_nodes;
RISCVCPU *cpu;
- char *isa;
+ g_autofree char *isa = NULL;
AcpiTable table = { .sig = "RHCT", .rev = 1, .oem_id = s->oem_id,
.oem_table_id = s->oem_table_id };
--
2.39.2
- [Stable-8.2.2 11/60] pci-host: designware: Limit value range of iATU viewport register, (continued)
- [Stable-8.2.2 11/60] pci-host: designware: Limit value range of iATU viewport register, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 12/60] tcg/loongarch64: Set vector registers call clobbered, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 13/60] linux-user/aarch64: Add padding before __kernel_rt_sigreturn, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 14/60] hw/scsi/lsi53c895a: add missing decrement of reentrancy counter, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 10/60] target/arm: Reinstate "vfp" property on AArch32 CPUs, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 16/60] iotests: give tempdir an identifying name, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 34/60] virtio-gpu: Correct virgl_renderer_resource_get_info() error check, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 38/60] hw/i386: Fix _STA return value for ACPI0017, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 39/60] tests/acpi: Update DSDT.cxl to reflect change _STA return value., Michael Tokarev, 2024/02/21
- [Stable-8.2.2 40/60] linux-user/aarch64: Choose SYNC as the preferred MTE mode, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 21/60] hw/riscv/virt-acpi-build.c: fix leak in build_rhct(),
Michael Tokarev <=
- [Stable-8.2.2 28/60] tcg/arm: Fix goto_tb for large translation blocks, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 27/60] tcg: Increase width of temp_subindex, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 20/60] migration: Fix logic of channels and transport compatibility check, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 23/60] configure: run plugin TCG tests again, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 29/60] vhost-user.rst: Fix vring address description, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 47/60] iotests: Make 144 deterministic again, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 51/60] i386/cpuid: Decrease cpuid_i when skipping CPUID leaf 1F, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 48/60] .gitlab-ci/windows.yml: Don't install libusb or spice packages on 32-bit, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 58/60] audio: Depend on dbus_display1_dep, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 56/60] ui/clipboard: add asserts for update and request, Michael Tokarev, 2024/02/21