- tests: bump QOS_PATH_MAX_ELEMENT_SIZE again - softmmu/physmem: fix memory leak in dirty_memory_extend() - crypto: run qcrypto_pbkdf2_count_iters in a new thread - hw/audio/virtio-sound: fix heap buffer overflow - hw/intc/arm_gic: fix spurious level triggered interrupts - ui/sdl2: set swap interval explicitly when OpenGL is enabled - target/riscv/kvm: tolerate KVM disable ext errors - virtio: remove virtio_tswap16s() call in vring_packed_event_read() - block: fix -Werror=maybe-uninitialized false-positive - hw/remote/vfio-user: Fix config space access byte order - hw/loongarch/virt: Fix memory leak - hw/intc/riscv_aplic: APLICs should add child earlier than realize - stdvga: fix screen blanking - ui/gtk: Draw guest frame at refresh cycle - target/i386: fix size of EBP writeback in gen_enter() - virtio-net: drop too short packets early - target/ppc: Fix lxv/stxv MSR facility check - target/ppc: Fix lxvx/stxvx facility check - virtio-snd: add max size bounds check in input cb(CVE-2024-7730) Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com> (cherry picked from commit e2eb79f1867bb8d8d870e758f06d2a32b3a4fc8a)
50 lines
1.9 KiB
Diff
50 lines
1.9 KiB
Diff
From 7d0006839846bef68fa3d96886b8e5d8f8ec52f1 Mon Sep 17 00:00:00 2001
|
|
From: Song Gao <gaosong@loongson.cn>
|
|
Date: Tue, 7 May 2024 10:22:39 +0800
|
|
Subject: [PATCH] hw/loongarch/virt: Fix memory leak
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
The char pointer 'ramName' point to a block of memory,
|
|
but never free it. Use 'g_autofree' to automatically free it.
|
|
|
|
Resolves: Coverity CID 1544773
|
|
|
|
Fixes: 0cf1478d6 ("hw/loongarch: Add numa support")
|
|
Signed-off-by: Song Gao <gaosong@loongson.cn>
|
|
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
|
|
Message-ID: <20240507022239.3113987-1-gaosong@loongson.cn>
|
|
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
|
|
(cherry picked from commit 54c52ec719fb8c83bbde54cb87b58688ab27c166)
|
|
Signed-off-by: zhujun2 <zhujun2_yewu@cmss.chinamobile.com>
|
|
---
|
|
hw/loongarch/virt.c | 3 +--
|
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
|
|
|
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
|
|
index 5d4fcb7a55..eca3b94581 100644
|
|
--- a/hw/loongarch/virt.c
|
|
+++ b/hw/loongarch/virt.c
|
|
@@ -925,7 +925,6 @@ static void loongarch_init(MachineState *machine)
|
|
const CPUArchIdList *possible_cpus;
|
|
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
|
CPUState *cpu;
|
|
- char *ramName = NULL;
|
|
struct loaderparams loaderparams = { };
|
|
|
|
if (!cpu_model) {
|
|
@@ -985,7 +984,7 @@ static void loongarch_init(MachineState *machine)
|
|
|
|
for (i = 1; i < nb_numa_nodes; i++) {
|
|
MemoryRegion *nodemem = g_new(MemoryRegion, 1);
|
|
- ramName = g_strdup_printf("loongarch.node%d.ram", i);
|
|
+ g_autofree char *ramName = g_strdup_printf("loongarch.node%d.ram", i);
|
|
memory_region_init_alias(nodemem, NULL, ramName, machine->ram,
|
|
offset, numa_info[i].node_mem);
|
|
memory_region_add_subregion(address_space_mem, phyAddr, nodemem);
|
|
--
|
|
2.41.0.windows.1
|
|
|