]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
test: testConnectClose: Set privateData to NULL in all cases
authorMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Thu, 8 Mar 2018 12:20:32 +0000 (13:20 +0100)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 15 Mar 2018 21:12:28 +0000 (17:12 -0400)
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>
src/test/test_driver.c

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