From: Marc Hartmayer Date: Thu, 8 Mar 2018 12:20:35 +0000 (+0100) Subject: test: fix error path in testConnectOpen X-Git-Tag: v4.2.0-rc1~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ee9c384da1d5f48658440f86ad1a88280907485;p=thirdparty%2Flibvirt.git test: fix error path in testConnectOpen In case of an error do the cleanup of the private data of the connection. 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 c3cb6cdd34..4de0cc5333 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -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; }