From: Marc Hartmayer Date: Thu, 8 Mar 2018 12:20:31 +0000 (+0100) Subject: test: testConnectAuthenticate: Take the lock when accessing mutable values X-Git-Tag: v4.2.0-rc1~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5428389b2bc5a6a1bf9dbc404b18cef816158d69;p=thirdparty%2Flibvirt.git test: testConnectAuthenticate: Take the lock when accessing mutable values Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 52dab5dd42..9ec4d806e1 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -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 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;