]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
test: testConnectAuthenticate: Take the lock when accessing mutable values
authorMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Thu, 8 Mar 2018 12:20:31 +0000 (13:20 +0100)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 15 Mar 2018 21:12:28 +0000 (17:12 -0400)
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/test/test_driver.c

index 52dab5dd4200a1f434c430eac94c1fbc682d7b3a..9ec4d806e194e31da269de450adb246939099d4f 100644 (file)
@@ -1369,8 +1369,11 @@ testConnectAuthenticate(virConnectPtr conn,
     ssize_t i;
     char *username = NULL, *password = NULL;
 
-    if (privconn->numAuths == 0)
+    testDriverLock(privconn);
+    if (privconn->numAuths == 0) {
+        testDriverUnlock(privconn);
         return 0;
+    }
 
     /* Authentication is required because the test XML contains a
      * non-empty <auth/> section.  First we must ask for a username.
@@ -1410,6 +1413,7 @@ testConnectAuthenticate(virConnectPtr conn,
 
     ret = 0;
  cleanup:
+    testDriverUnlock(privconn);
     VIR_FREE(username);
     VIR_FREE(password);
     return ret;