]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
test: fix error path in testConnectOpen
authorMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Thu, 8 Mar 2018 12:20:35 +0000 (13:20 +0100)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 15 Mar 2018 21:12:28 +0000 (17:12 -0400)
In case of an error do the cleanup of the private data of the
connection.

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 c3cb6cdd345789c9e1601d7d00e58d46b0a0872a..4de0cc5333b06543054dbeb8541afc7bb709b3ca 100644 (file)
@@ -1483,8 +1483,11 @@ testConnectOpen(virConnectPtr conn,
         return ret;
 
     /* Fake authentication. */
-    if (testConnectAuthenticate(conn, auth) < 0)
+    if (testConnectAuthenticate(conn, auth) < 0) {
+        testDriverCloseInternal(conn->privateData);
+        conn->privateData = NULL;
         return VIR_DRV_OPEN_ERROR;
+    }
 
     return VIR_DRV_OPEN_SUCCESS;
 }