[PATCH 2/2] tests: qemuhotplug: Don't free the monitor object as part of @vm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 8cceb883e..8a58d5468 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -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);
 }
-- 
2.11.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux