[PATCH 3/5] vz: fix memory leaks in prlsdkLoadDomains

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

 



Free sdkdom on any result of prlsdkNewDomainByHandle.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
---
 src/vz/vz_sdk.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index e7e9638..2f3f125 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1653,10 +1653,9 @@ prlsdkLoadDomains(vzDriverPtr driver)
         pret = PrlResult_GetParamByIndex(result, i, &sdkdom);
         prlsdkCheckRetGoto(pret, error);
 
-        if (!(dom = prlsdkNewDomainByHandle(driver, sdkdom)))
-            continue;
+        if ((dom = prlsdkNewDomainByHandle(driver, sdkdom)))
+            virObjectUnlock(dom);
 
-        virObjectUnlock(dom);
         PrlHandle_Free(sdkdom);
         sdkdom = PRL_INVALID_HANDLE;
     }
-- 
1.8.3.1

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