[v6 1/7] d3dx9: Introduce preshaders in effect.

Matteo Bruni matteo.mystral at gmail.com
Sun Mar 27 16:19:22 CDT 2016


2016-03-23 18:02 GMT+01:00 Paul Gofman <gofmanp at gmail.com>:

Sorry, I thought about this only now:

> @@ -5569,7 +5579,15 @@ static HRESULT d3dx9_parse_resource(struct d3dx9_base_effect *base, const char *
>              param->referenced_param = get_parameter_by_name(base, NULL, object->data);
>              if (param->referenced_param)
>              {
> -                TRACE("Mapping to parameter %p.\n", param->referenced_param);
> +                struct d3dx_parameter *refpar = param->referenced_param;
> +
> +                TRACE("Mapping to parameter %p, having object id %u.\n", refpar, refpar->object_id);
> +                if (refpar->type == D3DXPT_VERTEXSHADER || refpar->type == D3DXPT_PIXELSHADER)
> +                {
> +                    struct d3dx_object *refobj = &base->objects[refpar->object_id];
> +
> +                    d3dx_create_param_eval(base, refobj->data, refobj->size, refpar->type, &refpar->param_eval);
> +                }

If a parameter is referenced multiple times in an effect this probably
allocates the param_eval structure more than once, leaking all but the
last copy (well, it depends on the implementation of
d3dx_create_param_eval(), but it should be the case here).

I haven't tested that directly but I have tested that two references
to the vs_arr array seem to lead to a similar issue WRT the array
elements (i.e. the vertex shaders).



More information about the wine-devel mailing list