]> git.proxmox.com Git - mirror_qemu.git/commitdiff
iothread: check iothread->ctx before aio_context_unref to avoid assertion
authorLin Ma <lma@suse.com>
Mon, 26 Sep 2016 05:29:58 +0000 (13:29 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Wed, 28 Sep 2016 10:21:46 +0000 (11:21 +0100)
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 <lma@suse.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20160926052958.10716-1-lma@suse.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
iothread.c

index fb08a60b4b956b458eea4793a28511967aa7ad70..fbeb8deb385fea8d7d5199e9a2199415951c54c4 100644 (file)
@@ -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);
 }