From 2b18d257317df63dcdc7d01b16fd37f8e96f6fc9 Mon Sep 17 00:00:00 2001 From: David FORT Date: Thu, 25 Feb 2016 00:41:19 +0100 Subject: [PATCH] Added some checks --- client/Wayland/wlfreerdp.c | 7 ++++++- uwac/libuwac/uwac-input.c | 2 ++ uwac/libuwac/uwac-window.c | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/client/Wayland/wlfreerdp.c b/client/Wayland/wlfreerdp.c index 6c61ae4da..308147cab 100644 --- a/client/Wayland/wlfreerdp.c +++ b/client/Wayland/wlfreerdp.c @@ -92,6 +92,9 @@ static BOOL wl_end_paint(rdpContext* context) context_w = (wlfContext*) context; data = UwacWindowGetDrawingBuffer(context_w->window); + if (!data) + return FALSE; + for (i = 0; i < h; i++) { memcpy(data + ((i+y)*(gdi->width*4)) + x*4, @@ -99,7 +102,9 @@ static BOOL wl_end_paint(rdpContext* context) w*4); } - UwacWindowAddDamage(context_w->window, x, y, w, h); + if (UwacWindowAddDamage(context_w->window, x, y, w, h) != UWAC_SUCCESS) + return FALSE; + context_w->haveDamage = TRUE; return wl_update_content(context_w); } diff --git a/uwac/libuwac/uwac-input.c b/uwac/libuwac/uwac-input.c index 20d0ad01a..76e2f5ec4 100644 --- a/uwac/libuwac/uwac-input.c +++ b/uwac/libuwac/uwac-input.c @@ -742,6 +742,8 @@ seat_handle_name(void *data, struct wl_seat *seat, const char *name) free(input->name); input->name = strdup(name); + if (!input->name) + assert(uwacErrorHandler(input->display, UWAC_ERROR_NOMEMORY, "unable to strdup seat's name\n")); } static const struct wl_seat_listener seat_listener = { diff --git a/uwac/libuwac/uwac-window.c b/uwac/libuwac/uwac-window.c index fa3b860ea..b3fd370ad 100644 --- a/uwac/libuwac/uwac-window.c +++ b/uwac/libuwac/uwac-window.c @@ -296,6 +296,10 @@ int UwacWindowShmAllocBuffers(UwacWindow *w, int nbuffers, int allocSize, uint32 } pool = wl_shm_create_pool(w->display->shm, fd, allocSize * nbuffers); + if (!pool) { + ret = UWAC_ERROR_NOMEMORY; + goto error_mmap; + } for (i = 0; i < nbuffers; i++) { UwacBuffer *buffer = &w->buffers[w->nbuffers + i];