DIB_CreateDIBSection fix do not zero out memmory if it is a null pointer it got from...
authorMagnus Olsen <magnus@greatlord.com>
Thu, 29 Dec 2005 01:57:50 +0000 (01:57 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Thu, 29 Dec 2005 01:57:50 +0000 (01:57 +0000)
DIB_MapPaletteColors do not try write to NULL pointer if ExAllocatePoolWithTag do return a NULLL pointer.

svn path=/trunk/; revision=20411

reactos/subsys/win32k/objects/dib.c

index 4f46e2b..4f19471 100644 (file)
@@ -866,7 +866,7 @@ DIB_CreateDIBSection(
   if (bm.bmBits)
   {
     dib = ExAllocatePoolWithTag(PagedPool, sizeof(DIBSECTION), TAG_DIB);
-    RtlZeroMemory(dib, sizeof(DIBSECTION));
+    if (dib != NULL) RtlZeroMemory(dib, sizeof(DIBSECTION));
   }
 
   if (dib)
@@ -1125,6 +1125,12 @@ DIB_MapPaletteColors(PDC dc, CONST BITMAPINFO* lpbmi)
     }
 
   lpRGB = (RGBQUAD *)ExAllocatePoolWithTag(PagedPool, sizeof(RGBQUAD) * nNumColors, TAG_COLORMAP);
+  if (lpRGB == NULL)
+  {
+     PALETTE_UnlockPalette(palGDI);
+     return NULL;   
+  }
+  
   lpIndex = (USHORT *)&lpbmi->bmiColors[0];
 
   for (i = 0; i < nNumColors; i++)