aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2024-07-05 09:40:35 +0100
committerAlex Bennée <alex.bennee@linaro.org>2024-07-05 12:34:52 +0100
commit853c685e8cb4a53d29c3c61145638b22fd1b9659 (patch)
treef381e590c5b7676cf0d2418c18bd585c209f2cb6 /hw
parent2089a2e5bb81a258b7d30bf51a2ab7447ecc4e7f (diff)
plugins: Free CPUPluginState before destroying vCPU state
cpu::plugin_state is allocated in cpu_common_initfn() when the vCPU state is created. Release it in cpu_common_finalize() when we are done. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20240606124010.2460-3-philmd@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240705084047.857176-29-alex.bennee@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/core/cpu-common.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index f131cde2c0..8f6cb64da3 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -283,6 +283,11 @@ static void cpu_common_finalize(Object *obj)
{
CPUState *cpu = CPU(obj);
+#ifdef CONFIG_PLUGIN
+ if (tcg_enabled()) {
+ g_free(cpu->plugin_state);
+ }
+#endif
g_array_free(cpu->gdb_regs, TRUE);
qemu_lockcnt_destroy(&cpu->in_ioctl_lock);
qemu_mutex_destroy(&cpu->work_mutex);