[PATCH] hyperv: Avoid Coverity warning about resource leak in hypervOpen

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

 



Coverity tagged the esxhypervPrivate pointer a potentially leaked
because of the conditional free call. But this is a false positive,
there is not actual leak.

Avoid the conditial code to make this more obvious to Coverity.
---

This patch is meant as a replacement for this patch

https://www.redhat.com/archives/libvir-list/2013-January/msg00542.html

 src/hyperv/hyperv_driver.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 601a85a..0d2eaae 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -200,14 +200,11 @@ hypervOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
     }
 
     conn->privateData = priv;
-
+    priv = NULL;
     result = VIR_DRV_OPEN_SUCCESS;
 
   cleanup:
-    if (result == VIR_DRV_OPEN_ERROR) {
-        hypervFreePrivate(&priv);
-    }
-
+    hypervFreePrivate(&priv);
     VIR_FREE(username);
     VIR_FREE(password);
     hypervFreeObject(priv, (hypervObject *)computerSystem);
-- 
1.7.9.5

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