[ros-diffs] [tretiakov] 21589: EngCreateBitmap may return null. Add return value checks

tretiakov at svn.reactos.org tretiakov at svn.reactos.org
Fri Apr 14 18:31:07 CEST 2006


Author: tretiakov
Date: Fri Apr 14 20:31:06 2006
New Revision: 21589

URL: http://svn.reactos.ru/svn/reactos?rev=21589&view=rev
Log:
EngCreateBitmap may return null. Add return value checks

Modified:
    trunk/reactos/subsystems/win32/win32k/eng/engmisc.c
    trunk/reactos/subsystems/win32/win32k/eng/surface.c

Modified: trunk/reactos/subsystems/win32/win32k/eng/engmisc.c
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/engmisc.c?rev=21589&r1=21588&r2=21589&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/engmisc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/engmisc.c Fri Apr 14 20:31:06 2006
@@ -68,6 +68,13 @@
     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;

Modified: trunk/reactos/subsystems/win32/win32k/eng/surface.c
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/surface.c?rev=21589&r1=21588&r2=21589&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/surface.c (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/surface.c Fri Apr 14 20:31:06 2006
@@ -122,6 +122,12 @@
   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);




More information about the Ros-diffs mailing list