[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


 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;
-    if (result == VIR_DRV_OPEN_ERROR) {
-        hypervFreePrivate(&priv);
-    }
+    hypervFreePrivate(&priv);
     hypervFreeObject(priv, (hypervObject *)computerSystem);

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