From: Peter Krempa Date: Mon, 22 Jul 2013 14:57:08 +0000 (+0200) Subject: qemumonitortestutils: Don't crash on non fully initialized test X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a63a7a5af92e25662e623c51e44984cf4ab9deed;p=libvirt.git qemumonitortestutils: Don't crash on non fully initialized test 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. --- diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 34ca1ae51b..5ca569fc2f 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -368,7 +368,8 @@ qemuMonitorTestFree(qemuMonitorTestPtr test) virObjectUnref(test->vm); - virThreadJoin(&test->thread); + if (test->running) + virThreadJoin(&test->thread); if (timer != -1) virEventRemoveTimeout(timer);