From 1d77875a69b56f103eff1452d891b677144f6aac Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 24 Sep 2018 09:38:01 +0200 Subject: [PATCH] Fix NULL function pointer BeginPaint --- libfreerdp/gdi/gfx.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libfreerdp/gdi/gfx.c b/libfreerdp/gdi/gfx.c index a5e427fb3..f15c53a78 100644 --- a/libfreerdp/gdi/gfx.c +++ b/libfreerdp/gdi/gfx.c @@ -94,6 +94,7 @@ static UINT gdi_ResetGraphics(RdpgfxClientContext* context, static UINT gdi_OutputUpdate(rdpGdi* gdi, gdiGfxSurface* surface) { + UINT rc = ERROR_INTERNAL_ERROR; UINT32 nXDst, nYDst; UINT32 nXSrc, nYSrc; UINT16 width, height; @@ -118,7 +119,8 @@ static UINT gdi_OutputUpdate(rdpGdi* gdi, gdiGfxSurface* surface) if (!(rects = region16_rects(&surface->invalidRegion, &nbRects)) || !nbRects) return CHANNEL_RC_OK; - update->BeginPaint(gdi->context); + if (!IFCALLRESULT(TRUE, update->BeginPaint, gdi->context)) + goto fail; for (i = 0; i < nbRects; i++) { @@ -139,9 +141,13 @@ static UINT gdi_OutputUpdate(rdpGdi* gdi, gdiGfxSurface* surface) gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, width, height); } - update->EndPaint(gdi->context); + if (!IFCALLRESULT(FALSE, update->EndPaint, gdi->context)) + goto fail; + + rc = CHANNEL_RC_OK; +fail: region16_clear(&(surface->invalidRegion)); - return CHANNEL_RC_OK; + return rc; } static UINT gdi_UpdateSurfaces(RdpgfxClientContext* context)