aboutsummaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorMatheus Tavares Bernardino <quic_mathbern@quicinc.com>2024-06-12 14:04:46 -0300
committerMichael Tokarev <mjt@tls.msk.ru>2024-06-30 19:51:44 +0300
commit2b5d12b68514e3d81086a65fc8496822d5bd4359 (patch)
tree82a6ee2fa6cd4e294cc0c913e0f532ad5c773272 /hw/core
parentb35505523a000ea2080ba57bab7d8b3a02f8e854 (diff)
downloadqemu-2b5d12b68514e3d81086a65fc8496822d5bd4359.zip
qemu-2b5d12b68514e3d81086a65fc8496822d5bd4359.tar.gz
qemu-2b5d12b68514e3d81086a65fc8496822d5bd4359.tar.bz2
cpu: fix memleak of 'halt_cond' and 'thread'
Since a4c2735f35 (cpu: move Qemu[Thread|Cond] setup into common code, 2024-05-30) these fields are now allocated at cpu_common_initfn(). So let's make sure we also free them at cpu_common_finalize(). Furthermore, the code also frees these on round robin, but we missed 'halt_cond'. Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/cpu-common.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index bf1a7b8..f131cde 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -286,6 +286,9 @@ static void cpu_common_finalize(Object *obj)
g_array_free(cpu->gdb_regs, TRUE);
qemu_lockcnt_destroy(&cpu->in_ioctl_lock);
qemu_mutex_destroy(&cpu->work_mutex);
+ qemu_cond_destroy(cpu->halt_cond);
+ g_free(cpu->halt_cond);
+ g_free(cpu->thread);
}
static int64_t cpu_common_get_arch_id(CPUState *cpu)