From 0bb048d35ea2824de8ed8f31c146163622f3ed38 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 22 Jan 2017 10:46:23 -0800 Subject: [PATCH] Fix several cases of discarding return values --- libxrdp/libxrdp.c | 15 ++++++++++---- xrdp/xrdp_mm.c | 50 +++++++++++++++++++++++++++++++++++++---------- 2 files changed, 51 insertions(+), 14 deletions(-) diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c index d81a56d5..25d25a99 100644 --- a/libxrdp/libxrdp.c +++ b/libxrdp/libxrdp.c @@ -275,6 +275,7 @@ libxrdp_process_data(struct xrdp_session *session, struct stream *s) int EXPORT_CC libxrdp_send_palette(struct xrdp_session *session, int *palette) { + int rv; int i = 0; int color = 0; struct stream *s = (struct stream *)NULL; @@ -337,10 +338,16 @@ libxrdp_send_palette(struct xrdp_session *session, int *palette) free_stream(s); /* send the orders palette too */ - libxrdp_orders_init(session); - libxrdp_orders_send_palette(session, palette, 0); - libxrdp_orders_send(session); - return 0; + rv = libxrdp_orders_init(session); + if (rv == 0) + { + rv = libxrdp_orders_send_palette(session, palette, 0); + } + if (rv == 0) + { + rv = libxrdp_orders_send(session); + } + return rv; } /******************************************************************************/ diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 84af0063..38c6ecd9 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -823,8 +823,14 @@ xrdp_mm_process_rail_create_window(struct xrdp_mm* self, struct stream* s) } in_uint32_le(s, flags); rv = libxrdp_orders_init(self->wm->session); - rv = libxrdp_window_new_update(self->wm->session, window_id, &rwso, flags); - rv = libxrdp_orders_send(self->wm->session); + if (rv == 0) + { + rv = libxrdp_window_new_update(self->wm->session, window_id, &rwso, flags); + } + if (rv == 0) + { + rv = libxrdp_orders_send(self->wm->session); + } g_free(rwso.title_info); g_free(rwso.window_rects); g_free(rwso.visibility_rects); @@ -892,8 +898,14 @@ xrdp_mm_process_rail_configure_window(struct xrdp_mm* self, struct stream* s) } in_uint32_le(s, flags); rv = libxrdp_orders_init(self->wm->session); - rv = libxrdp_window_new_update(self->wm->session, window_id, &rwso, flags); - rv = libxrdp_orders_send(self->wm->session); + if (rv == 0) + { + rv = libxrdp_window_new_update(self->wm->session, window_id, &rwso, flags); + } + if (rv == 0) + { + rv = libxrdp_orders_send(self->wm->session); + } g_free(rwso.window_rects); g_free(rwso.visibility_rects); return rv; @@ -912,8 +924,14 @@ xrdp_mm_process_rail_destroy_window(struct xrdp_mm* self, struct stream* s) in_uint32_le(s, window_id); g_writeln("xrdp_mm_process_rail_destroy_window 0x%8.8x", window_id); rv = libxrdp_orders_init(self->wm->session); - rv = libxrdp_window_delete(self->wm->session, window_id); - rv = libxrdp_orders_send(self->wm->session); + if (rv == 0) + { + rv = libxrdp_window_delete(self->wm->session, window_id); + } + if (rv == 0) + { + rv = libxrdp_orders_send(self->wm->session); + } return rv; } @@ -935,8 +953,14 @@ xrdp_mm_process_rail_show_window(struct xrdp_mm* self, struct stream* s) g_writeln("xrdp_mm_process_rail_show_window 0x%8.8x %x", window_id, rwso.show_state); rv = libxrdp_orders_init(self->wm->session); - rv = libxrdp_window_new_update(self->wm->session, window_id, &rwso, flags); - rv = libxrdp_orders_send(self->wm->session); + if (rv == 0) + { + rv = libxrdp_window_new_update(self->wm->session, window_id, &rwso, flags); + } + if (rv == 0) + { + rv = libxrdp_orders_send(self->wm->session); + } return rv; } @@ -965,8 +989,14 @@ xrdp_mm_process_rail_update_window_text(struct xrdp_mm* self, struct stream* s) rwso.title_info[size] = 0; g_writeln(" set window title %s size %d 0x%8.8x", rwso.title_info, size, flags); rv = libxrdp_orders_init(self->wm->session); - rv = libxrdp_window_new_update(self->wm->session, window_id, &rwso, flags); - rv = libxrdp_orders_send(self->wm->session); + if (rv == 0) + { + rv = libxrdp_window_new_update(self->wm->session, window_id, &rwso, flags); + } + if (rv == 0) + { + rv = libxrdp_orders_send(self->wm->session); + } g_writeln(" set window title %s %d", rwso.title_info, rv); g_free(rwso.title_info);