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

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



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


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