Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/vz/vz_sdk.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index b7627e7..67c68df 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1642,17 +1642,16 @@ prlsdkLoadDomain(vzDriverPtr driver, virDomainObjPtr dom)
prlsdkConvertDomainState(domainState, envId, dom);
- if (!pdom->sdkdom) {
- PrlHandle_AddRef(sdkdom);
+ if (pdom->sdkdom == PRL_INVALID_HANDLE)
pdom->sdkdom = sdkdom;
- }
+ else
+ PrlHandle_Free(sdkdom);
if (autostart == PAO_VM_START_ON_LOAD)
dom->autostart = 1;
else
dom->autostart = 0;
- PrlHandle_Free(sdkdom);
return 0;
error:
PrlHandle_Free(sdkdom);
--
1.8.3.1