Handle failure of EngCreateClip, spotted by Amine Khaldi
authorGregor Schneider <grschneider@gmail.com>
Sun, 16 Aug 2009 19:56:40 +0000 (19:56 +0000)
committerGregor Schneider <grschneider@gmail.com>
Sun, 16 Aug 2009 19:56:40 +0000 (19:56 +0000)
svn path=/trunk/; revision=42743

reactos/subsystems/win32/win32k/eng/engmisc.c

index 776db0f..183e010 100644 (file)
@@ -103,6 +103,12 @@ IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave,
         ClippedDestRect.bottom = ClippedDestRect.top + psoDest->sizlBitmap.cy - SrcPoint.y;
       }
     EnterLeave->TrivialClipObj = EngCreateClip();
+    if (EnterLeave->TrivialClipObj == NULL)
+    {
+        EngUnlockSurface(*ppsoOutput);
+        EngDeleteSurface((HSURF)EnterLeave->OutputBitmap);
+        return FALSE;
+    }
     EnterLeave->TrivialClipObj->iDComplexity = DC_TRIVIAL;
     if (ClippedDestRect.left < (*ppsoOutput)->sizlBitmap.cx &&
         0 <= ClippedDestRect.right &&
@@ -115,11 +121,11 @@ IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave,
                                         EnterLeave->TrivialClipObj, NULL,
                                         &ClippedDestRect, &SrcPoint))
       {
-      EngDeleteClip(EnterLeave->TrivialClipObj);
-      EngFreeMem((*ppsoOutput)->pvBits);
-      EngUnlockSurface(*ppsoOutput);
-      EngDeleteSurface((HSURF)EnterLeave->OutputBitmap);
-      return FALSE;
+          EngDeleteClip(EnterLeave->TrivialClipObj);
+          EngFreeMem((*ppsoOutput)->pvBits);
+          EngUnlockSurface(*ppsoOutput);
+          EngDeleteSurface((HSURF)EnterLeave->OutputBitmap);
+          return FALSE;
       }
     EnterLeave->DestRect.left = DestRect->left;
     EnterLeave->DestRect.top = DestRect->top;