diff mbox series

[3/4] cpu: Free cpu->cpu_ases in cpu_exec_unrealizefn()

Message ID 20220126142946.667782-4-mark.kanda@oracle.com (mailing list archive)
State New, archived
Headers show
Series vCPU hotunplug related memory leaks | expand

Commit Message

Mark Kanda Jan. 26, 2022, 2:29 p.m. UTC
vCPU hotunplug related leak reported by Valgrind:

==377357== 216 bytes in 1 blocks are definitely lost in loss record 7,042 of 8,471
==377357==    at 0x4C3ADBB: calloc (vg_replace_malloc.c:1117)
==377357==    by 0x65C14CD: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.5600.4)
==377357==    by 0x78552E: cpu_address_space_init (physmem.c:750)
==377357==    by 0x78175B: qemu_init_vcpu (cpus.c:629)
==377357==    by 0x7185A3: x86_cpu_realizefn (cpu.c:6447)
==377357==    by 0x8E46B7: device_set_realized (qdev.c:531)
==377357==    by 0x8EE36F: property_set_bool (object.c:2268)
==377357==    by 0x8EC3C5: object_property_set (object.c:1403)
==377357==    by 0x8F075D: object_property_set_qobject (qom-qobject.c:28)
==377357==    by 0x8EC72C: object_property_set_bool (object.c:1472)
==377357==    by 0x8E3F7F: qdev_realize (qdev.c:333)
==377357==    by 0x43F3A2: qdev_device_add_from_qdict (qdev-monitor.c:711)

Signed-off-by: Mark Kanda <mark.kanda@oracle.com>
---
 cpu.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/cpu.c b/cpu.c
index 016bf06a1a..d5c730164a 100644
--- a/cpu.c
+++ b/cpu.c
@@ -170,6 +170,7 @@  void cpu_exec_unrealizefn(CPUState *cpu)
     if (tcg_enabled()) {
         tcg_exec_unrealizefn(cpu);
     }
+    g_free(cpu->cpu_ases);
 
     cpu_list_remove(cpu);
 }