]> xenbits.xensource.com Git - libvirt.git/commitdiff
rpc: silence coverity false positives
authorEric Blake <eblake@redhat.com>
Tue, 2 Aug 2011 22:02:48 +0000 (16:02 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 2 Aug 2011 22:39:01 +0000 (16:39 -0600)
In virNetServerNew, Coverity didn't realize that srv->mdsnGroupName
can only be non-NULL if mdsnGroupName was non-NULL.

In virNetServerRun, Coverity didn't realize that the array is non-NULL
if the array count is non-zero.

* src/rpc/virnetserver.c (virNetServerNew): Use alternate pointer.
(virNetServerRun): Give coverity a hint.

src/rpc/virnetserver.c

index 4deeca17dbcc1d9afebb9b258257bc89c586131e..5e4826bc3e8440ac230aae5c550a8a0863b45371 100644 (file)
@@ -308,7 +308,8 @@ virNetServerPtr virNetServerNew(size_t min_workers,
     if (srv->mdnsGroupName) {
         if (!(srv->mdns = virNetServerMDNSNew()))
             goto error;
-        if (!(srv->mdnsGroup = virNetServerMDNSAddGroup(srv->mdns, mdnsGroupName)))
+        if (!(srv->mdnsGroup = virNetServerMDNSAddGroup(srv->mdns,
+                                                        srv->mdnsGroupName)))
             goto error;
     }
 #endif
@@ -702,6 +703,9 @@ void virNetServerRun(virNetServerPtr srv)
 
     reprocess:
         for (i = 0 ; i < srv->nclients ; i++) {
+            /* Coverity 5.3.0 couldn't see that srv->clients is non-NULL
+             * if srv->nclients is non-zero.  */
+            sa_assert(srv->clients);
             if (virNetServerClientWantClose(srv->clients[i]))
                 virNetServerClientClose(srv->clients[i]);
             if (virNetServerClientIsClosed(srv->clients[i])) {