diff options
author | Francois Gouget <fgouget@codeweavers.com> | 2016-08-11 12:22:08 +0200 |
---|---|---|
committer | Victor Toso <victortoso@redhat.com> | 2016-08-12 14:41:22 +0200 |
commit | dbaa3238eebf9b7bc0ec59fcf2df856d28e6a5e1 (patch) | |
tree | 781b14fe8b2dc5c4f8c69f1dae80d18a454062e3 /src | |
parent | 12a92b8d02a0d382936f467289a17efe350b4a4f (diff) |
streaming: Don't crash if the stream creation fails
Note that this implies closing the stream before receiving any frame.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Victor Toso <victortoso@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/channel-display.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/channel-display.c b/src/channel-display.c index 22c54f2..709b3d2 100644 --- a/src/channel-display.c +++ b/src/channel-display.c @@ -109,6 +109,7 @@ static display_surface *find_surface(SpiceDisplayChannelPrivate *c, guint32 surf static void spice_display_channel_reset(SpiceChannel *channel, gboolean migrating); static void spice_display_channel_reset_capabilities(SpiceChannel *channel); static void destroy_canvas(display_surface *surface); +static void destroy_stream(SpiceChannel *channel, int id); static void display_session_mm_time_reset_cb(SpiceSession *session, gpointer data); static SpiceGlScanout* spice_gl_scanout_copy(const SpiceGlScanout *scanout); @@ -1125,6 +1126,7 @@ static void display_handle_stream_create(SpiceChannel *channel, SpiceMsgIn *in) } if (st->video_decoder == NULL) { spice_printerr("could not create a video decoder for codec %u", op->codec_type); + destroy_stream(channel, op->id); } } @@ -1231,6 +1233,7 @@ static void display_update_stream_report(SpiceDisplayChannel *channel, uint32_t g_return_if_fail(c->nstreams > stream_id); st = channel->priv->streams[stream_id]; + g_return_if_fail(st != NULL); if (!st->report_is_active) { return; @@ -1353,6 +1356,7 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in) g_return_if_fail(c->nstreams > op->id); st = c->streams[op->id]; + g_return_if_fail(st != NULL); mmtime = stream_get_time(st); if (spice_msg_in_type(in) == SPICE_MSG_DISPLAY_STREAM_DATA_SIZED) { @@ -1420,6 +1424,7 @@ static void display_handle_stream_clip(SpiceChannel *channel, SpiceMsgIn *in) g_return_if_fail(c->nstreams > op->id); st = c->streams[op->id]; + g_return_if_fail(st != NULL); if (st->msg_clip) { spice_msg_in_unref(st->msg_clip); |