mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
2089a2e5bb
commit
853c685e8c
|
@ -283,6 +283,11 @@ static void cpu_common_finalize(Object *obj)
|
||||||
{
|
{
|
||||||
CPUState *cpu = CPU(obj);
|
CPUState *cpu = CPU(obj);
|
||||||
|
|
||||||
|
#ifdef CONFIG_PLUGIN
|
||||||
|
if (tcg_enabled()) {
|
||||||
|
g_free(cpu->plugin_state);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
g_array_free(cpu->gdb_regs, TRUE);
|
g_array_free(cpu->gdb_regs, TRUE);
|
||||||
qemu_lockcnt_destroy(&cpu->in_ioctl_lock);
|
qemu_lockcnt_destroy(&cpu->in_ioctl_lock);
|
||||||
qemu_mutex_destroy(&cpu->work_mutex);
|
qemu_mutex_destroy(&cpu->work_mutex);
|
||||||
|
|
|
@ -149,6 +149,9 @@ struct CPUPluginState {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qemu_plugin_create_vcpu_state: allocate plugin state
|
* 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);
|
CPUPluginState *qemu_plugin_create_vcpu_state(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue