Author: fireball
Date: Wed Jul 23 10:18:25 2008
New Revision: 34693
URL:
http://svn.reactos.org/svn/reactos?rev=34693&view=rev
Log:
- Revert 20424 and do a proper fix: Check if pool allocation succeeded right after
allocation, not at the end of the function, when the pointer has been used quite a few
times already.
Modified:
trunk/reactos/subsystems/win32/win32k/objects/palobj.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/palobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/palobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/palobj.c [iso-8859-1] Wed Jul 23
10:18:25 2008
@@ -248,6 +248,12 @@
ExFreePool(palPtr->mapping);
mapping = ExAllocatePoolWithTag(PagedPool, sizeof(int)*palGDI->NumColors,
TAG_PALETTEMAP);
+ if (!mapping)
+ {
+ DPRINT1("Failed allocating memory for palette mapping!\n");
+ return 0;
+ }
+
palPtr->mapping = mapping;
for(uNum += uStart; uStart < uNum; uStart++)
@@ -326,11 +332,7 @@
}
if( !prevMapping || palPtr->mapping[uStart] != index ) iRemapped++;
- if (palPtr->mapping != NULL)
- {
- palPtr->mapping[uStart] = index;
- }
-
+ palPtr->mapping[uStart] = index;
}
return iRemapped;
}