Merge pull request #4121 from ondrejholy/setsurface-segfault-fix

Various fixes from #4117
This commit is contained in:
David Fort 2017-09-18 10:17:43 +02:00 committed by GitHub
commit a514ae9638
3 changed files with 10 additions and 3 deletions

View File

@ -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)

View File

@ -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);
}

View File

@ -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");