[libvirt] [PATCH 16/26] network: Resolve Coverity FORWARD_NULL

John Ferlan jferlan at redhat.com
Thu Sep 4 22:26:24 UTC 2014


If the VIR_STRDUP(exptime,...) fails, then we will jump to cleanup,
no need to check if exptime is set which causes Coverity to issue
a complaint in the virStrToLong_ll call because there wasn't a check
for a NULL value while there was one for the reference right after
the VIR_STRDUP().

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/network/leaseshelper.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index c8543a2..5b3c9c3 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -180,8 +180,7 @@ main(int argc, char **argv)
         goto cleanup;
 
     /* Removed extraneous trailing space in DNSMASQ_LEASE_EXPIRES (dnsmasq < 2.52) */
-    if (exptime &&
-        exptime[strlen(exptime) - 1] == ' ')
+    if (exptime[strlen(exptime) - 1] == ' ')
         exptime[strlen(exptime) - 1] = '\0';
 
     /* Check if it is an IPv6 lease */
-- 
1.9.3




More information about the libvir-list mailing list