diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index c9338b5be0..650b79051e 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -264,8 +264,10 @@ parallelsConnectOpen(virConnectPtr conn, if ((ret = parallelsOpenDefault(conn)) != VIR_DRV_OPEN_SUCCESS || (ret = parallelsStorageOpen(conn, flags)) != VIR_DRV_OPEN_SUCCESS || - (ret = parallelsNetworkOpen(conn, flags)) != VIR_DRV_OPEN_SUCCESS) + (ret = parallelsNetworkOpen(conn, flags)) != VIR_DRV_OPEN_SUCCESS) { + parallelsConnectClose(conn); return ret; + } return VIR_DRV_OPEN_SUCCESS; } @@ -275,6 +277,9 @@ parallelsConnectClose(virConnectPtr conn) { parallelsConnPtr privconn = conn->privateData; + if (!privconn) + return 0; + parallelsNetworkClose(conn); parallelsStorageClose(conn); diff --git a/src/parallels/parallels_network.c b/src/parallels/parallels_network.c index a347a09413..e1c6040deb 100644 --- a/src/parallels/parallels_network.c +++ b/src/parallels/parallels_network.c @@ -344,6 +344,10 @@ parallelsNetworkOpen(virConnectPtr conn, int parallelsNetworkClose(virConnectPtr conn) { parallelsConnPtr privconn = conn->privateData; + + if (!privconn) + return 0; + parallelsDriverLock(privconn); virNetworkObjListFree(privconn->networks); VIR_FREE(privconn->networks); diff --git a/src/parallels/parallels_storage.c b/src/parallels/parallels_storage.c index a6980a477a..6397601aa9 100644 --- a/src/parallels/parallels_storage.c +++ b/src/parallels/parallels_storage.c @@ -72,9 +72,15 @@ parallelsStorageClose(virConnectPtr conn) { parallelsConnPtr privconn = conn->privateData; + if (!privconn) + return 0; + virStorageDriverStatePtr storageState = privconn->storageState; privconn->storageState = NULL; + if (!storageState) + return 0; + parallelsStorageLock(storageState); virStoragePoolObjListFree(&privconn->pools); VIR_FREE(storageState->configDir);