OSDN Git Service

tests: fix coroutine leak in /basic/entered
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 4 Jan 2018 16:05:21 +0000 (17:05 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 16 Jan 2018 13:54:50 +0000 (14:54 +0100)
commit6b2fef739127ee6135d5ccc2da0bf1f3bebf66b7
tree65e36b1c86f597b8c0db73d6b169040064fa345a
parente313d5cec564a9b708bad1bb44c291530a5a4935
tests: fix coroutine leak in /basic/entered

The coroutine is not finished by the time the test ends, resulting in
ASAN warning:

==7005==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 312 byte(s) in 1 object(s) allocated from:
    #0 0x7fd35290fa38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38)
    #1 0x7fd3506c5f75 in g_malloc0 ../glib/gmem.c:124
    #2 0x55994af03e47 in qemu_coroutine_new /home/elmarco/src/qemu/util/coroutine-ucontext.c:144
    #3 0x55994aefed99 in qemu_coroutine_create /home/elmarco/src/qemu/util/qemu-coroutine.c:76
    #4 0x55994ac1eb50 in verify_entered_step_1 /home/elmarco/src/qemu/tests/test-coroutine.c:80
    #5 0x55994af03c75 in coroutine_trampoline /home/elmarco/src/qemu/util/coroutine-ucontext.c:119
    #6 0x7fd34ec02bef  (/lib64/libc.so.6+0x50bef)

Do not yield() to let the coroutine terminate.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20180104160523.22995-17-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tests/test-coroutine.c