]> xenbits.xensource.com Git - people/dariof/libvirt.git/commitdiff
qemumonitortestutils: Don't crash on non fully initialized test
authorPeter Krempa <pkrempa@redhat.com>
Mon, 22 Jul 2013 14:57:08 +0000 (16:57 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 31 Jul 2013 12:25:43 +0000 (14:25 +0200)
The qemumonitorjsontest crashed when one of the initialization steps
done before starting the worker thread failed. This patch fixes this by
trying to pthread_join() the thread only after it was created.

tests/qemumonitortestutils.c

index 34ca1ae51b8a4840793ded3114d82696d96d543b..5ca569fc2f30ffa6610d6944386326ae157068ac 100644 (file)
@@ -368,7 +368,8 @@ qemuMonitorTestFree(qemuMonitorTestPtr test)
 
     virObjectUnref(test->vm);
 
-    virThreadJoin(&test->thread);
+    if (test->running)
+        virThreadJoin(&test->thread);
 
     if (timer != -1)
         virEventRemoveTimeout(timer);