From eb7b5c35117bfb90dcfa881a0e3b23368c73fba6 Mon Sep 17 00:00:00 2001 From: Lin Ma Date: Mon, 26 Sep 2016 13:29:58 +0800 Subject: iothread: check iothread->ctx before aio_context_unref to avoid assertion if iothread->ctx is set to NULL, aio_context_unref triggers the assertion: g_source_unref: assertion 'source != NULL' failed. The patch fixes it. Signed-off-by: Lin Ma Reviewed-by: Paolo Bonzini Message-id: 20160926052958.10716-1-lma@suse.com Signed-off-by: Stefan Hajnoczi --- iothread.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iothread.c b/iothread.c index fb08a60b4b..fbeb8deb38 100644 --- a/iothread.c +++ b/iothread.c @@ -75,6 +75,9 @@ static void iothread_instance_finalize(Object *obj) iothread_stop(obj, NULL); qemu_cond_destroy(&iothread->init_done_cond); qemu_mutex_destroy(&iothread->init_done_lock); + if (!iothread->ctx) { + return; + } aio_context_unref(iothread->ctx); } -- cgit v1.2.3