mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
test: testConnectAuthenticate: Take the lock when accessing mutable values
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>
This commit is contained in:
parent
ba8bd17a6a
commit
5428389b2b
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user