Received: from eggs.gnu.org ([2001:4830:134:3::10]:53303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpJRH-0001Db-Fy for qemu-devel@nongnu.org; Wed, 28 Sep 2016 14:18:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpJRC-0006cI-FT for qemu-devel@nongnu.org; Wed, 28 Sep 2016 14:18:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37556) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpJRC-0006cC-9f for qemu-devel@nongnu.org; Wed, 28 Sep 2016 14:18:34 -0400 From: Stefan Hajnoczi Date: Wed, 28 Sep 2016 19:15:33 +0100 Message-Id: <1475086537-31704-4-git-send-email-stefanha@redhat.com> In-Reply-To: <1475086537-31704-1-git-send-email-stefanha@redhat.com> References: <1475086537-31704-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 3/7] 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: Peter Maydell , Lin Ma , Stefan Hajnoczi From: Lin Ma 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 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.7.4