On 08/02/2011 05:58 PM, Eric Blake wrote:
Detected by Coverity.
* src/rpc/virnetserverclient.c (virNetServerClientDispatchRead):
Avoid null deref on OOM.
---
src/rpc/virnetserverclient.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 2f6c040..e246fa5 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -786,9 +786,10 @@ readmore:
if (client->nrequests< client->nrequests_max) {
if (!(client->rx = virNetMessageNew())) {
client->wantClose = true;
+ } else {
+ client->rx->bufferLength = VIR_NET_MESSAGE_LEN_MAX;
+ client->nrequests++;
}
- client->rx->bufferLength = VIR_NET_MESSAGE_LEN_MAX;
- client->nrequests++;
}
virNetServerClientUpdateEvent(client);
}
ACK.