rpc: silence coverity false positives

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.
This commit is contained in:
Eric Blake 2011-08-02 16:02:48 -06:00
parent 8d0be8fd57
commit 0634b62336
1 changed files with 5 additions and 1 deletions

View 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])) {