735c6b
From c07df2b480134357e6ecb53f61eb1d8295b2b406 Mon Sep 17 00:00:00 2001
735c6b
Message-Id: <c07df2b480134357e6ecb53f61eb1d8295b2b406@dist-git>
735c6b
From: Peter Krempa <pkrempa@redhat.com>
735c6b
Date: Wed, 15 Feb 2023 10:43:53 +0100
735c6b
Subject: [PATCH] rpc: client: Don't check return value of virNetMessageNew
735c6b
MIME-Version: 1.0
735c6b
Content-Type: text/plain; charset=UTF-8
735c6b
Content-Transfer-Encoding: 8bit
735c6b
735c6b
virNetServerClientDispatchRead checked the return value but it's not
735c6b
necessary any more as it can't return NULL nowadays.
735c6b
735c6b
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
735c6b
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
735c6b
(cherry picked from commit 761cb8a0876d32445951791030c77afa147c0de1)
735c6b
https://bugzilla.redhat.com/show_bug.cgi?id=2145188
735c6b
---
735c6b
 src/rpc/virnetserverclient.c | 11 ++++-------
735c6b
 1 file changed, 4 insertions(+), 7 deletions(-)
735c6b
735c6b
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
735c6b
index c9a4eb521e..b5c764b1b0 100644
735c6b
--- a/src/rpc/virnetserverclient.c
735c6b
+++ b/src/rpc/virnetserverclient.c
735c6b
@@ -1257,13 +1257,10 @@ static virNetMessage *virNetServerClientDispatchRead(virNetServerClient *client)
735c6b
 
735c6b
         /* Possibly need to create another receive buffer */
735c6b
         if (client->nrequests < client->nrequests_max) {
735c6b
-            if (!(client->rx = virNetMessageNew(true))) {
735c6b
-                client->wantClose = true;
735c6b
-            } else {
735c6b
-                client->rx->bufferLength = VIR_NET_MESSAGE_LEN_MAX;
735c6b
-                client->rx->buffer = g_new0(char, client->rx->bufferLength);
735c6b
-                client->nrequests++;
735c6b
-            }
735c6b
+            client->rx = virNetMessageNew(true);
735c6b
+            client->rx->bufferLength = VIR_NET_MESSAGE_LEN_MAX;
735c6b
+            client->rx->buffer = g_new0(char, client->rx->bufferLength);
735c6b
+            client->nrequests++;
735c6b
         } else if (!client->nrequests_warning) {
735c6b
             client->nrequests_warning = true;
735c6b
             VIR_WARN("Client hit max requests limit %zd. This may result "
735c6b
-- 
735c6b
2.39.1
735c6b