test: testConnectClose: Set privateData to NULL in all cases

Set privateData to NULL also for a connection that uses @defaultConn
as privateData regardless of whether @defaultConn was freed or
not. @defaultConn is shared between multiple connections and it's
ensured that there will be no memory leak by counting references.

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:
Marc Hartmayer 2018-03-08 13:20:32 +01:00 committed by John Ferlan
parent 5428389b2b
commit 81b2a8e024

View File

@ -1472,6 +1472,7 @@ static int testConnectClose(virConnectPtr conn)
dflt = true;
virMutexLock(&defaultLock);
if (--defaultConnections) {
conn->privateData = NULL;
virMutexUnlock(&defaultLock);
return 0;
}