[PATCH] d3dx9: Correctly handle sprites array reallocation.

Henri Verbeet hverbeet at gmail.com
Mon Nov 23 09:20:04 CST 2020


On Fri, 20 Nov 2020 at 21:58, Matteo Bruni <mbruni at 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.



More information about the wine-devel mailing list