diff mbox series

[2/4] softmmu/cpus: Free cpu->halt_cond in cpu_remove_sync()

Message ID 20220126142946.667782-3-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== 56 bytes in 1 blocks are definitely lost in loss record 5,017 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 0x8B5AE0: kvm_start_vcpu_thread (kvm-accel-ops.c:69)
==377357==    by 0x7817AF: qemu_init_vcpu (cpus.c:634)
==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>
---
 softmmu/cpus.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index 1d8380d4aa..edaa36f6dc 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -604,6 +604,7 @@  void cpu_remove_sync(CPUState *cpu)
     qemu_thread_join(cpu->thread);
     qemu_mutex_lock_iothread();
     g_free(cpu->thread);
+    g_free(cpu->halt_cond);
 }
 
 void cpus_register_accel(const AccelOpsClass *ops)