hw/loongarch/virt.c: Fixes memory leak in ramName during loop iterations
PATCH 1/1 hw/loongarch/virt.c: Fixes memory leak in ramName during loop iterations
This patch fixes a memory leak in the ramName variable within the hw/loongarch/virt.c file. The leak occurs due to repeated calls to g_strdup_printf within a loop, causing memory allocated for ramName on previous iterations to be unfreed.
--- hw/loongarch/virt.c | 1 + 1 file changed, 1 insertion(+)
hw/loongarch/virt.c +1 -0
@@ -954,6 +954,7 @@ static void loongarch_init(MachineState *machine)fdt_add_memory_node (machine, phyAddr, numa_info[i].node_mem, i); offset += numa_info[i].node_mem; phyAddr += numa_info[i].node_mem; +g_free (ramName); }/* initialize device memory address space */
Signature · 1 line
2.40.1
Hi R.
Quoted 15 lines · R.Samarasekara
This patch fixes a memory leak in the ramName variable within the
hw/loongarch/virt.cfile. The leak occurs due to repeated calls tog_strdup_printfwithin a loop, causing memory allocated for ramName on previous iterations to be unfreed.Signed-off-by R.Samarasekara <[email protected]>--- hw/loongarch/virt.c | 1 + 1 file changed, 1 insertion(+)hw/loongarch/virt.c +0
-0
hw/loongarch/virt.c static void loongarch_init(MachineState *machine) · line 958
Quoted 5 lines
hw/loongarch/virt.c +1
-0@@ -954,6 +954,7 @@ static void loongarch_init(MachineState *machine)fdt_add_memory_node (machine, phyAddr, numa_info[i].node_mem, i); offset += numa_info[i].node_mem; phyAddr += numa_info[i].node_mem; +g_free (ramName); }
This has been fixed recently in this commit:
https://gitlab.com/qemu-project/qemu/-/commit/54c52ec719
Regards,
Phil.