diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2024-07-05 09:40:35 +0100 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2024-07-05 12:34:52 +0100 |
commit | 853c685e8cb4a53d29c3c61145638b22fd1b9659 (patch) | |
tree | f381e590c5b7676cf0d2418c18bd585c209f2cb6 | |
parent | 2089a2e5bb81a258b7d30bf51a2ab7447ecc4e7f (diff) | |
download | qemu-853c685e8cb4a53d29c3c61145638b22fd1b9659.zip qemu-853c685e8cb4a53d29c3c61145638b22fd1b9659.tar.gz qemu-853c685e8cb4a53d29c3c61145638b22fd1b9659.tar.bz2 |
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>
-rw-r--r-- | hw/core/cpu-common.c | 5 | ||||
-rw-r--r-- | include/qemu/plugin.h | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index f131cde..8f6cb64 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); diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index bc5aef9..af5f9db 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -149,6 +149,9 @@ struct CPUPluginState { /** * qemu_plugin_create_vcpu_state: allocate plugin state + * + * The returned data must be released with g_free() + * when no longer required. */ CPUPluginState *qemu_plugin_create_vcpu_state(void); |