summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Gouget <fgouget@codeweavers.com>2015-10-30 12:17:30 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2015-11-04 12:08:35 +0100
commit64319761e16abeac6572b8f3a33c5d0193f7dda4 (patch)
tree5f5fcc6eb4e7058e0cdb1d00eacf50455f4b7fbe
parent36c7db9a38cc5335727c2abbe7968112eb6667e0 (diff)
downloadspice-gtk-64319761e16abeac6572b8f3a33c5d0193f7dda4.tar.gz
spice-gtk-64319761e16abeac6572b8f3a33c5d0193f7dda4.tar.xz
spice-gtk-64319761e16abeac6572b8f3a33c5d0193f7dda4.zip
spice-gtk: Fix error handling in stream_get_current_frame()
*data must always be set to NULL on error. Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
-rw-r--r--src/channel-display.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/channel-display.c b/src/channel-display.c
index 46e9829..9e42dd9 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -1081,20 +1081,21 @@ uint32_t stream_get_current_frame(display_stream *st, uint8_t **data)
return 0;
}
- if (spice_msg_in_type(st->msg_data) == SPICE_MSG_DISPLAY_STREAM_DATA) {
+ switch (spice_msg_in_type(st->msg_data)) {
+ case SPICE_MSG_DISPLAY_STREAM_DATA: {
SpiceMsgDisplayStreamData *op = spice_msg_in_parsed(st->msg_data);
-
*data = op->data;
return op->data_size;
- } else {
+ }
+ case SPICE_MSG_DISPLAY_STREAM_DATA_SIZED: {
SpiceMsgDisplayStreamDataSized *op = spice_msg_in_parsed(st->msg_data);
-
- g_return_val_if_fail(spice_msg_in_type(st->msg_data) ==
- SPICE_MSG_DISPLAY_STREAM_DATA_SIZED, 0);
*data = op->data;
return op->data_size;
- }
-
+ }
+ default:
+ *data = NULL;
+ g_return_val_if_reached(0);
+ }
}
G_GNUC_INTERNAL