Alexander Dorofeyev alexd4@inbox.lv writes:
- if (PaletteNumber >= This->NumberOfPalettes) {
NewSize = This->NumberOfPalettes;
do {
NewSize *= 2;
} while(PaletteNumber >= NewSize);
palettes = HeapReAlloc(GetProcessHeap(), 0, This->palettes, sizeof(PALETTEENTRY[256]) * NewSize);
You should be using an array of pointers, not a single array for all palettes, so that you don't need to move around the whole data on each realloc.