[Spice-devel] [PATCH] dcc: avoid to report errors triggered by client

Frediano Ziglio fziglio at redhat.com
Fri Jan 8 03:30:09 PST 2016


Client can always send report even if a stream is not available.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/dcc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/server/dcc.c b/server/dcc.c
index 7c16fc0..47dcc76 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -1332,9 +1332,15 @@ static int dcc_handle_stream_report(DisplayChannelClient *dcc,
 {
     StreamAgent *agent;
 
-    spice_return_val_if_fail(report->stream_id < NUM_STREAMS, FALSE);
+    if (report->stream_id >= NUM_STREAMS) {
+        return FALSE;
+    }
+
     agent = &dcc->stream_agents[report->stream_id];
-    spice_return_val_if_fail(agent->mjpeg_encoder, TRUE);
+    if (!agent->mjpeg_encoder) {
+        return TRUE;
+    }
+
     spice_return_val_if_fail(report->unique_id == agent->report_id, TRUE);
 
     mjpeg_encoder_client_stream_report(agent->mjpeg_encoder,
-- 
2.4.3



More information about the Spice-devel mailing list