Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/sprite.c:
- } - else if (This->allocated_sprites <= This->sprite_count) - { - new_sprites = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - This->sprites, This->allocated_sprites * 2 * sizeof(*This->sprites)); - if (!new_sprites) - return E_OUTOFMEMORY; - This->sprites = new_sprites; - This->allocated_sprites *= 2; - } + new_size = This->allocated_sprites ? This->allocated_sprites * 2 : 32; + new_sprites = realloc(This->sprites, new_size * sizeof(*This->sprites)); + if (!new_sprites) + return E_OUTOFMEMORY; + This->sprites = new_sprites; + This->allocated_sprites = new_size; This is reallocating the buffer every time instead of only as needed.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4539#note_54553