On Thu, 2015-12-24 at 15:58 +0300, Maxim Nestratov wrote:
In case of prlsdkLoadDomains fails, vzOpenDefault should
clear connection privateData pointer every time its
memory is actually freed.
Also it is not necessary to call vzConnectClose if a call
to vzOpenDefault fails, because they both make cleanup of
connection privateData.
ACKed and pushed, thanks.
Signed-off-by: Maxim Nestratov <mnestratov(a)virtuozzo.com>
---
src/vz/vz_driver.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 2ef47e4..dfcffb4 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -266,6 +266,7 @@ vzOpenDefault(virConnectPtr conn)
prlsdkDisconnect(privconn);
prlsdkDeinit();
err_free:
+ conn->privateData = NULL;
VIR_FREE(privconn);
return VIR_DRV_OPEN_ERROR;
}
@@ -307,10 +308,8 @@ vzConnectOpen(virConnectPtr conn,
return VIR_DRV_OPEN_ERROR;
}
- if ((ret = vzOpenDefault(conn)) != VIR_DRV_OPEN_SUCCESS) {
- vzConnectClose(conn);
+ if ((ret = vzOpenDefault(conn)) != VIR_DRV_OPEN_SUCCESS)
return ret;
- }
return VIR_DRV_OPEN_SUCCESS;
}