rpc: avoid null deref

Detected by Coverity.

* src/rpc/virnetserverclient.c (virNetServerClientDispatchRead):
Avoid null deref on OOM.
This commit is contained in:
Eric Blake 2011-08-02 15:57:19 -06:00
parent 44ebb18ec2
commit 8d0be8fd57

View File

@ -786,10 +786,11 @@ readmore:
if (client->nrequests < client->nrequests_max) { if (client->nrequests < client->nrequests_max) {
if (!(client->rx = virNetMessageNew())) { if (!(client->rx = virNetMessageNew())) {
client->wantClose = true; client->wantClose = true;
} } else {
client->rx->bufferLength = VIR_NET_MESSAGE_LEN_MAX; client->rx->bufferLength = VIR_NET_MESSAGE_LEN_MAX;
client->nrequests++; client->nrequests++;
} }
}
virNetServerClientUpdateEvent(client); virNetServerClientUpdateEvent(client);
} }
} }