summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Qiang <liq3ea@163.com>2019-01-01 23:41:14 -0800
committerPaolo Bonzini <pbonzini@redhat.com>2019-03-11 16:55:51 +0100
commit611dbe46093d901cf01c1b252dd39441b95d1c35 (patch)
tree3958cbf8847c85af8213fec55b1c5ae7ff84acff
parent494d199727ba248c96326b4e1c97f86eb11a5ec7 (diff)
downloadqemu-611dbe46093d901cf01c1b252dd39441b95d1c35.zip
qom: cpu: destroy work_mutex in cpu_common_finalize
Commit 376692b9dc6(cpus: protect work list with work_mutex) initialize a work_mutex in cpu_common_initfn, however forget to destroy it. This will cause resource leak when hotunplug cpu or hotplug cpu fails. Signed-off-by: Li Qiang <liq3ea@163.com> Message-Id: <20190102074114.26988-1-liq3ea@163.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--qom/cpu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/qom/cpu.c b/qom/cpu.c
index f5579b1cd5..a8d2958956 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -380,6 +380,9 @@ static void cpu_common_initfn(Object *obj)
static void cpu_common_finalize(Object *obj)
{
+ CPUState *cpu = CPU(obj);
+
+ qemu_mutex_destroy(&cpu->work_mutex);
}
static int64_t cpu_common_get_arch_id(CPUState *cpu)