]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: qemuhotplug: Don't free the monitor object as part of @vm
authorPeter Krempa <pkrempa@redhat.com>
Thu, 2 Feb 2017 15:42:18 +0000 (16:42 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 2 Feb 2017 15:46:43 +0000 (16:46 +0100)
The test monitor should be freed separately so we need to remove the
pointer from the @vm object. This fixes a race condition crash in the
test introduced in commit a245abce43.

tests/qemuhotplugtest.c

index 8cceb883ed9b0ba542ea3d144ab1fe3e63199a5b..8a58d5468c52bb85324562c4b0aba99e5c851dbc 100644 (file)
@@ -365,6 +365,8 @@ struct testQemuHotplugCpuData {
 static void
 testQemuHotplugCpuDataFree(struct testQemuHotplugCpuData *data)
 {
+    qemuDomainObjPrivatePtr priv;
+
     if (!data)
         return;
 
@@ -375,7 +377,13 @@ testQemuHotplugCpuDataFree(struct testQemuHotplugCpuData *data)
 
     VIR_FREE(data->xml_dom);
 
-    virObjectUnref(data->vm);
+    if (data->vm) {
+        priv = data->vm->privateData;
+        priv->mon = NULL;
+
+        virObjectUnref(data->vm);
+    }
+
     qemuMonitorTestFree(data->mon);
     VIR_FREE(data);
 }