[libvirt PATCH 2/7] qemusecuritytest: 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/qemusecuritytest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/qemusecuritytest.c b/tests/qemusecuritytest.c
index a7e87fdf8f..b14da08f1b 100644
--- a/tests/qemusecuritytest.c
+++ b/tests/qemusecuritytest.c
@@ -114,7 +114,7 @@ testDomain(const void *opaque)
     /* Mocking is enabled only when this env variable is set.
      * See mock code for explanation. */
     if (g_setenv(ENVVAR, "1", FALSE) == FALSE)
-        return -1;
+        goto cleanup;
 
     if (qemuSecuritySetAllLabel(data->driver, vm, NULL, false) < 0)
         goto cleanup;
@@ -126,6 +126,7 @@ testDomain(const void *opaque)
 
     ret = 0;
  cleanup:
+    virObjectUnlock(vm);
     g_unsetenv(ENVVAR);
     freePaths();
     return ret;
-- 
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