From a9161f091399489289dcbc052f9e82b8095fc557 Mon Sep 17 00:00:00 2001 From: Saveliy Tretiakov Date: Fri, 14 Apr 2006 16:31:06 +0000 Subject: [PATCH] EngCreateBitmap may return null. Add return value checks svn path=/trunk/; revision=21589 --- reactos/subsystems/win32/win32k/eng/engmisc.c | 7 +++++++ reactos/subsystems/win32/win32k/eng/surface.c | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/reactos/subsystems/win32/win32k/eng/engmisc.c b/reactos/subsystems/win32/win32k/eng/engmisc.c index 5f35b6f3f66..77cac7cd912 100644 --- a/reactos/subsystems/win32/win32k/eng/engmisc.c +++ b/reactos/subsystems/win32/win32k/eng/engmisc.c @@ -68,6 +68,13 @@ IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave, EnterLeave->OutputBitmap = EngCreateBitmap(BitmapSize, Width, DestObj->iBitmapFormat, BMF_TOPDOWN | BMF_NOZEROINIT, NULL); + + if (!EnterLeave->OutputBitmap) + { + DPRINT1("EngCreateBitmap() failed\n"); + return FALSE; + } + *OutputObj = EngLockSurface((HSURF)EnterLeave->OutputBitmap); EnterLeave->DestRect.left = 0; diff --git a/reactos/subsystems/win32/win32k/eng/surface.c b/reactos/subsystems/win32/win32k/eng/surface.c index e83124aacd7..d4245ec6078 100644 --- a/reactos/subsystems/win32/win32k/eng/surface.c +++ b/reactos/subsystems/win32/win32k/eng/surface.c @@ -122,6 +122,12 @@ EngCreateDeviceBitmap(IN DHSURF dhsurf, SURFOBJ *SurfObj; NewBitmap = EngCreateBitmap(Size, DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(Format)), Format, 0, NULL); + if(!NewBitmap) + { + DPRINT1("EngCreateBitmap failed\n"); + return 0; + } + SurfObj = EngLockSurface((HSURF)NewBitmap); SurfObj->dhsurf = dhsurf; EngUnlockSurface(SurfObj);