From: Maxim Nestratov Date: Thu, 24 Dec 2015 12:58:59 +0000 (+0300) Subject: vz: BUG: fix connecting hang in case of init failure X-Git-Tag: v1.3.1-rc1~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=635daa2556b003c3a1d19f1a850511fbc0ccff46;p=thirdparty%2Flibvirt.git 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 --- diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 2452d964cf..4348213e4f 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; }