[PATCHv2 10/10] build: silence coverity false positive

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

 



Coverity couldn't see that priv is clean on failure.  But on failure,
we might as well guarantee that callers don't try to free uninitialized
memory.

* src/remote/remote_driver.c (remoteGenericOpen): Even on failure,
pass priv back to caller.
---

In reading my own mail, I decided that patch 10 can be made simpler.

v2: rewrite to avoid sa_assert and be more robust.

 src/remote/remote_driver.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 14c3d24..8335a1a 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2545,10 +2545,8 @@ remoteGenericOpen(virConnectPtr conn, virConnectAuthPtr auth,
          * use the UNIX transport. This handles Xen driver
          * which doesn't have its own impl of the network APIs. */
         struct private_data *priv;
-        int ret;
-        ret = remoteOpenSecondaryDriver(conn, auth, flags, &priv);
-        if (ret == VIR_DRV_OPEN_SUCCESS)
-            *genericPrivateData = priv;
+        int ret = remoteOpenSecondaryDriver(conn, auth, flags, &priv);
+        *genericPrivateData = priv;
         return ret;
     }
 }
-- 
1.7.4.4

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