cpu: Free queued CPU work
Running qemu-system-aarch64 -M virt -nographic and terminating it will result in a LeakSanitizer error due to remaining queued CPU work so free it. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Link: https://lore.kernel.org/r/20240714-cpu-v1-1-19c2f8de2055@daynix.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
e0bf95443e
commit
f8b64d35a6
11
cpu-common.c
11
cpu-common.c
@@ -331,6 +331,17 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func,
|
||||
queue_work_on_cpu(cpu, wi);
|
||||
}
|
||||
|
||||
void free_queued_cpu_work(CPUState *cpu)
|
||||
{
|
||||
while (!QSIMPLEQ_EMPTY(&cpu->work_list)) {
|
||||
struct qemu_work_item *wi = QSIMPLEQ_FIRST(&cpu->work_list);
|
||||
QSIMPLEQ_REMOVE_HEAD(&cpu->work_list, node);
|
||||
if (wi->free) {
|
||||
g_free(wi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void process_queued_cpu_work(CPUState *cpu)
|
||||
{
|
||||
struct qemu_work_item *wi;
|
||||
|
Reference in New Issue
Block a user