Re: [PATCH 1/3] vz: simplify refcount on sdkdom in prlsdkLoadDomain

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

 



03.06.2016 10:11, Nikolay Shirokovskiy пишет:

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
---
  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 7eb78ca..73bf748 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1615,17 +1615,16 @@ prlsdkLoadDomain(vzDriverPtr driver, virDomainObjPtr dom)
prlsdkConvertDomainState(domainState, envId, dom); - if (!pdom->sdkdom) {
-        PrlHandle_AddRef(sdkdom);
+    if (pdom->sdkdom == PRL_INVALID_HANDLE)

This change implies knowledge that PRL_INVALID_HANDLE is equal to 0
while it is not obvious and we don't explicitly set pdom->sdkdom to PRL_INVALID_HANDLE
when we allocate vzDomObj.
Thus, this change doesn't seem to simply things, rather it complicates at least my understanding,
and I think we could easily avoid it.


          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);

--
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]