diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c index de7e03f23..67c8dec41 100644 --- a/client/X11/xf_graphics.c +++ b/client/X11/xf_graphics.c @@ -202,6 +202,10 @@ static BOOL xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary) { xfContext* xfc = (xfContext*) context; + + if (!context || (!bitmap && !primary)) + return FALSE; + xf_lock_x11(xfc, FALSE); if (primary) diff --git a/libfreerdp/cache/offscreen.c b/libfreerdp/cache/offscreen.c index df79fc822..a07012d6d 100644 --- a/libfreerdp/cache/offscreen.c +++ b/libfreerdp/cache/offscreen.c @@ -60,7 +60,7 @@ static BOOL update_gdi_create_offscreen_bitmap(rdpContext* context, if (!bitmap->New(context, bitmap)) { - free(bitmap); + Bitmap_Free(context, bitmap); return FALSE; } @@ -101,6 +101,9 @@ static BOOL update_gdi_switch_surface(rdpContext* context, { rdpBitmap* bmp; bmp = offscreen_cache_get(cache->offscreen, switchSurface->bitmapId); + if (bmp == NULL) + return FALSE; + bitmap->SetSurface(context, bmp, FALSE); } diff --git a/libfreerdp/core/orders.c b/libfreerdp/core/orders.c index 2ee97e664..8427c7e7e 100644 --- a/libfreerdp/core/orders.c +++ b/libfreerdp/core/orders.c @@ -2460,7 +2460,7 @@ static BOOL update_read_create_offscreen_bitmap_order(wStream* s, if (deleteList->cIndices > deleteList->sIndices) { UINT16* new_indices; - new_indices = (UINT16*)realloc(deleteList->indices, deleteList->sIndices * 2); + new_indices = (UINT16*)realloc(deleteList->indices, deleteList->cIndices * 2); if (!new_indices) return FALSE; @@ -3451,7 +3451,7 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, break; case ORDER_TYPE_GDIPLUS_END: - if (update_read_draw_gdiplus_end_order(s, &(altsec->draw_gdiplus_end))) + if (!update_read_draw_gdiplus_end_order(s, &(altsec->draw_gdiplus_end))) { WLog_ERR(TAG, "ORDER_TYPE_GDIPLUS_END - update_read_draw_gdiplus_end_order() failed");