- 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.

svn path=/trunk/; revision=34693
This commit is contained in:
Aleksey Bragin 2008-07-23 15:18:25 +00:00
parent 981b8ac8ca
commit dd1b21d54b

View file

@ -248,6 +248,12 @@ INT STDCALL PALETTE_SetMapping(PALOBJ *palPtr, UINT uStart, UINT uNum, BOOL mapO
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 @@ INT STDCALL PALETTE_SetMapping(PALOBJ *palPtr, UINT uStart, UINT uNum, BOOL mapO
}
if( !prevMapping || palPtr->mapping[uStart] != index ) iRemapped++;
if (palPtr->mapping != NULL)
{
palPtr->mapping[uStart] = index;
}
palPtr->mapping[uStart] = index;
}
return iRemapped;
}