vz: BUG: fix connecting hang in case of init failure

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.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
This commit is contained in:
Maxim Nestratov 2015-12-24 15:58:59 +03:00 committed by Dmitry Guryanov
parent 53a15aed39
commit 635daa2556

View File

@ -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;
}