On 9/25/18 7:23 PM, Marc-André Lureau wrote: > Spotted by ASAN: > > QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 tests/bios-tables-test > -p /x86_64/acpi/piix4/cpuhp > /x86_64/acpi/piix4/cpuhp: Could not access KVM kernel module: No such file or > directory > qemu-system-x86_64: failed to initialize KVM: No such file or directory > qemu-system-x86_64: Back to tcg accelerator > ==21216==WARNING: ASan doesn't fully support makecontext/swapcontext > functions and may produce false positives in some cases! > > ================================================================= > ==21216==ERROR: LeakSanitizer: detected memory leaks > > Direct leak of 48 byte(s) in 1 object(s) allocated from: > #0 0x7f77c0668e50 in calloc (/lib64/libasan.so.5+0xeee50) > #1 0x7f77beb7b41d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d) > #2 0x557f756df5bd in timer_new > /home/elmarco/src/qemu/include/qemu/timer.h:561 > #3 0x557f756df5ee in timer_new_ns > /home/elmarco/src/qemu/include/qemu/timer.h:584 > #4 0x557f756e4690 in start_tcg_kick_timer > /home/elmarco/src/qemu/cpus.c:965 > #5 0x557f756e64d7 in qemu_tcg_rr_wait_io_event > /home/elmarco/src/qemu/cpus.c:1210 > #6 0x557f756e90ad in qemu_tcg_rr_cpu_thread_fn > /home/elmarco/src/qemu/cpus.c:1536 > #7 0x557f76e9f233 in qemu_thread_start > /home/elmarco/src/qemu/util/qemu-thread-posix.c:504 > #8 0x7f77b4a11593 in start_thread (/lib64/libpthread.so.0+0x7593) > > Direct leak of 48 byte(s) in 1 object(s) allocated from: > #0 0x7f77c0668e50 in calloc (/lib64/libasan.so.5+0xeee50) > #1 0x7f77beb7b41d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d) > #2 0x557f756df5bd in timer_new > /home/elmarco/src/qemu/include/qemu/timer.h:561 > #3 0x557f756df5ee in timer_new_ns > /home/elmarco/src/qemu/include/qemu/timer.h:584 > #4 0x557f756e4690 in start_tcg_kick_timer > /home/elmarco/src/qemu/cpus.c:965 > #5 0x557f756e8616 in qemu_tcg_rr_cpu_thread_fn > /home/elmarco/src/qemu/cpus.c:1466 > #6 0x557f76e9f233 in qemu_thread_start > /home/elmarco/src/qemu/util/qemu-thread-posix.c:504 > #7 0x7f77b4a11593 in start_thread (/lib64/libpthread.so.0+0x7593) > > SUMMARY: AddressSanitizer: 96 byte(s) leaked in 2 allocation(s). > > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <phi...@redhat.com> > --- > cpus.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/cpus.c b/cpus.c > index 719788320f..0513c657f4 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -973,6 +973,7 @@ static void stop_tcg_kick_timer(void) > assert(!mttcg_enabled); > if (tcg_kick_vcpu_timer) { > timer_del(tcg_kick_vcpu_timer); > + timer_free(tcg_kick_vcpu_timer); > tcg_kick_vcpu_timer = NULL; > } > } >