From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boOUg-00033L-3N for qemu-devel@nongnu.org; Mon, 26 Sep 2016 01:30:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1boOUb-0007JA-VG for qemu-devel@nongnu.org; Mon, 26 Sep 2016 01:30:21 -0400 Received: from prv3-mh.provo.novell.com ([137.65.250.26]:35704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boOUb-0007I7-Oi for qemu-devel@nongnu.org; Mon, 26 Sep 2016 01:30:17 -0400 From: Lin Ma Date: Mon, 26 Sep 2016 13:29:58 +0800 Message-Id: <20160926052958.10716-1-lma@suse.com> Subject: [Qemu-devel] [PATCH] iothread: check iothread->ctx before aio_context_unref to avoid assertion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: famz@redhat.com, pbonzini@redhat.com, stefanha@redhat.com 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 --- iothread.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iothread.c b/iothread.c index fb08a60..fbeb8de 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); } -- 2.9.2