[PATCH 5/5] d3dx9: Correctly handle out of memory conditions while reallocating children array.

Matteo Bruni matteo.mystral at gmail.com
Tue Aug 26 09:58:50 CDT 2014


2014-08-26 16:30 GMT+02:00 Henri Verbeet <hverbeet at gmail.com>:
> On 26 August 2014 16:13, Matteo Bruni <mbruni at codeweavers.com> wrote:
>> @@ -338,15 +338,20 @@ static HRESULT d3dx9_file_data_create(IDirectXFileObject *dxfile_object, ID3DXFi
>>
>>      while (SUCCEEDED(ret = IDirectXFileData_GetNextObject(object->dxfile_data, &data_object)))
> ...
>> +            new_children = HeapReAlloc(GetProcessHeap(), 0, object->children,
>> +                    sizeof(*object->children) * (object->nb_children + 1));
> While I suspect this is hardly the only thing wrong with xfile.c, it
> seems suboptimal to grow the array by 1 each time you go through the
> loop.

Yeah, it should start at some size greater than 1 (no idea about
typical children count here though) and then grow exponentially. I
guess that can be a separate patch, but I can also add it to this one
and resend if preferred.



More information about the wine-devel mailing list