[PATCH] vz: BUG: fix connecting hang in case of init failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]