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 <fziglio@redhat.com>
Acked-by: Julien Rope <jrope@redhat.com>
This commit is contained in:
Frediano Ziglio 2020-01-21 15:45:42 +00:00
parent 7026f12c1b
commit 1ce119009a
2 changed files with 6 additions and 2 deletions

View File

@ -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);

View File

@ -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);