Re: [PATCH 13/3] rpc: avoid null deref

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]