mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 08:05:43 +00:00
- 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:
parent
981b8ac8ca
commit
dd1b21d54b
1 changed files with 7 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue