Message ID | 20181211095057.14623-8-fli@suse.com |
---|---|
State | New |
Headers | show |
Series | qemu_thread_create: propagate errors to callers to check | expand |
diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 81b40a1ece..cb3722a4f4 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -566,6 +566,9 @@ void *qemu_thread_join(QemuThread *thread) int err; void *ret; + if (!thread->thread) { + return NULL; + } err = pthread_join(thread->thread, &ret); if (err) { error_exit(err, __func__); diff --git a/util/qemu-thread-win32.c b/util/qemu-thread-win32.c index 57b1143e97..ca4d5329e3 100644 --- a/util/qemu-thread-win32.c +++ b/util/qemu-thread-win32.c @@ -367,7 +367,7 @@ void *qemu_thread_join(QemuThread *thread) HANDLE handle; data = thread->data; - if (data->mode == QEMU_THREAD_DETACHED) { + if (data == NULL || data->mode == QEMU_THREAD_DETACHED) { return NULL; }