tinus <o112w8r02@sneakemail.com>
Don't allocate 0 bytes of memory for no color map.
Modified: trunk/reactos/subsys/win32k/objects/dib.c

Modified: trunk/reactos/subsys/win32k/objects/dib.c
--- trunk/reactos/subsys/win32k/objects/dib.c	2005-03-11 17:33:12 UTC (rev 13932)
+++ trunk/reactos/subsys/win32k/objects/dib.c	2005-03-11 18:17:29 UTC (rev 13933)
@@ -883,8 +883,15 @@
     if(bi->biBitCount == 4) { Entries = 16; } else
     if(bi->biBitCount == 8) { Entries = 256; }
 
-    bmp->ColorMap = ExAllocatePoolWithTag(PagedPool, sizeof(RGBQUAD)*Entries, TAG_COLORMAP);
-    RtlCopyMemory(bmp->ColorMap, bmi->bmiColors, sizeof(RGBQUAD)*Entries);
+    if (Entries)
+    {
+      bmp->ColorMap = ExAllocatePoolWithTag(PagedPool, sizeof(RGBQUAD)*Entries, TAG_COLORMAP);
+      RtlCopyMemory(bmp->ColorMap, bmi->bmiColors, sizeof(RGBQUAD)*Entries);
+    }
+    else
+    {
+      bmp->ColorMap = NULL;
+    }
   }
 
   // Clean up in case of errors