On Fri, 20 Nov 2020 at 21:58, Matteo Bruni <mbruni(a)codeweavers.com> wrote:
@@ -358,8 +359,11 @@ static HRESULT WINAPI d3dx9_sprite_Draw(ID3DXSprite *iface, IDirect3DTexture9 *t else if (This->allocated_sprites <= This->sprite_count) { This->allocated_sprites += This->allocated_sprites / 2; - This->sprites = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + new_sprites = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->sprites, This->allocated_sprites * sizeof(*This->sprites)); + if (!new_sprites) + return E_OUTOFMEMORY; + This->sprites = new_sprites; } This is probably an improvement over what was there before, but note that "allocated_sprites" is still updated on allocation failure.