From 1ce119009aff6d11aceeff0696a664883bb62fc4 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Tue, 21 Jan 2020 15:45:42 +0000 Subject: [PATCH] Do not crash if channel clients cannot be created Channel client creation can fail in some situation. For instance if during a migration the client is disconnected. In most cases this is ignored (this is usually logged in red_channel_client_initable_init) but not in case of CursorChannelClient and StreamChannelClient. This fixes rhbz#1788757. Signed-off-by: Frediano Ziglio Acked-by: Julien Rope --- server/cursor-channel.c | 4 +++- server/stream-channel.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/cursor-channel.c b/server/cursor-channel.c index fa2ddf83..138a0bd6 100644 --- a/server/cursor-channel.c +++ b/server/cursor-channel.c @@ -348,7 +348,9 @@ cursor_channel_connect(CursorChannel *cursor, RedClient *client, RedStream *stre ccc = cursor_channel_client_new(cursor, client, stream, migrate, caps); - spice_return_if_fail(ccc != NULL); + if (ccc == NULL) { + return; + } RedChannelClient *rcc = RED_CHANNEL_CLIENT(ccc); red_channel_client_ack_zero_messages_window(rcc); diff --git a/server/stream-channel.c b/server/stream-channel.c index 9841ff66..1d71c126 100644 --- a/server/stream-channel.c +++ b/server/stream-channel.c @@ -441,7 +441,9 @@ stream_channel_connect(RedChannel *red_channel, RedClient *red_client, RedStream spice_return_if_fail(stream != NULL); client = stream_channel_client_new(channel, red_client, stream, migration, caps); - spice_return_if_fail(client != NULL); + if (client == NULL) { + return; + } // request new stream start->num_codecs = stream_channel_get_supported_codecs(channel, start->codecs);