[PATCH 01/10] d3dx9: Avoid double freeing samplers.

Paul Gofman gofmanp at gmail.com
Tue Nov 12 13:01:17 CST 2019


On 11/12/19 21:48, Matteo Bruni wrote:
>
>> Signed-off-by: Paul Gofman <gofmanp at gmail.com>
>> ---
>>  dlls/d3dx9_36/effect.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
>> index e69a1fd1f8..980313182a 100644
>> --- a/dlls/d3dx9_36/effect.c
>> +++ b/dlls/d3dx9_36/effect.c
>> @@ -517,7 +517,6 @@ static void free_sampler(struct d3dx_sampler *sampler)
>>          free_state(&sampler->states[i]);
>>      }
>>      HeapFree(GetProcessHeap(), 0, sampler->states);
>> -    HeapFree(GetProcessHeap(), 0, sampler);
>>  }
>>
>>  static void d3dx_pool_release_shared_parameter(struct d3dx_top_level_parameter *param);
>> @@ -557,7 +556,7 @@ static void free_parameter_data(struct d3dx_parameter *param, BOOL child)
>>                  break;
>>          }
>>      }
>> -    if (!child)
>> +    if (!child || is_param_type_sampler(param->type))
>>          HeapFree(GetProcessHeap(), 0, param->data);
>>  }
> Seems fine but do D3DXPT_STRING parameters also require the same?

I thought it doesn't. Unless I am missing something obvious the case
which frees the strings does that for the pointers stored at 'data'
address, it is just the same what happens with the other objects (if
they get freed on _Release). Only sampler's case frees the 'data'
pointer itself as it points directly to sampler's structure.




More information about the wine-devel mailing list