[libvirt PATCH 3/7] qemuxml2argvtest: Unlock virDomainObj before disposal

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

 



virDomainObj contains a mutex. Destroying a locked mutex results in
undefined behavior.

Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 tests/qemuxml2argvtest.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b552f5deed..4276f062a2 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -562,8 +562,9 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv,
     if (virBitmapParse("0-3", &priv->autoNodeset, 4) < 0)
         return -1;
 
-    if (!(cmd = testCompareXMLToArgvCreateArgs(drv, vm, migrateURI, info, flags,
-                                               true)))
+    cmd = testCompareXMLToArgvCreateArgs(drv, vm, migrateURI, info, flags, true);
+    virDomainObjEndAPI(&vm);
+    if (!cmd)
         return -1;
 
     if (virCommandGetArgList(cmd, &args, &nargs) < 0)
@@ -767,8 +768,9 @@ testCompareXMLToArgv(const void *data)
     VIR_FREE(log);
     virResetLastError();
 
-    if (!(cmd = testCompareXMLToArgvCreateArgs(&driver, vm, migrateURI, info,
-                                               flags, false))) {
+    cmd = testCompareXMLToArgvCreateArgs(&driver, vm, migrateURI, info, flags, false);
+    virDomainObjEndAPI(&vm);
+    if (!cmd) {
         err = virGetLastError();
         if (!err) {
             VIR_TEST_DEBUG("no error was reported for expected failure");
@@ -816,7 +818,7 @@ testCompareXMLToArgv(const void *data)
  cleanup:
     VIR_FREE(log);
     virDomainChrSourceDefClear(&monitor_chr);
-    virObjectUnref(vm);
+    virDomainObjEndAPI(&vm);
     virIdentitySetCurrent(NULL);
     virSetConnectSecret(NULL);
     virSetConnectStorage(NULL);
-- 
2.31.1




[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