<div style="white-space:pre-wrap">Yes, sorry, this is the case. It looks like I already changed it later in preliminary shared parameters (pool) implementation, but did not get back to the right patch in the sequence where it is also a problem. <br>Should I resend the patches with just these changes or wait for your comments on the remaining part?<br><br>PS I think there might be also a similar problem for object creation in effect parsing when there are multiple object_id 0 in effect (which is accompanied by a warning that object is already created which is seen quite often), data copying code does not free existing pointer.</div><br><div class="gmail_quote"><div dir="ltr">On Mon, 28 Mar 2016 at 00:19, Matteo Bruni <<a href="mailto:matteo.mystral@gmail.com">matteo.mystral@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2016-03-23 18:02 GMT+01:00 Paul Gofman <<a href="mailto:gofmanp@gmail.com" target="_blank">gofmanp@gmail.com</a>>:<br>
<br>
Sorry, I thought about this only now:<br>
<br>
> @@ -5569,7 +5579,15 @@ static HRESULT d3dx9_parse_resource(struct d3dx9_base_effect *base, const char *<br>
>              param->referenced_param = get_parameter_by_name(base, NULL, object->data);<br>
>              if (param->referenced_param)<br>
>              {<br>
> -                TRACE("Mapping to parameter %p.\n", param->referenced_param);<br>
> +                struct d3dx_parameter *refpar = param->referenced_param;<br>
> +<br>
> +                TRACE("Mapping to parameter %p, having object id %u.\n", refpar, refpar->object_id);<br>
> +                if (refpar->type == D3DXPT_VERTEXSHADER || refpar->type == D3DXPT_PIXELSHADER)<br>
> +                {<br>
> +                    struct d3dx_object *refobj = &base->objects[refpar->object_id];<br>
> +<br>
> +                    d3dx_create_param_eval(base, refobj->data, refobj->size, refpar->type, &refpar->param_eval);<br>
> +                }<br>
<br>
If a parameter is referenced multiple times in an effect this probably<br>
allocates the param_eval structure more than once, leaking all but the<br>
last copy (well, it depends on the implementation of<br>
d3dx_create_param_eval(), but it should be the case here).<br>
<br>
I haven't tested that directly but I have tested that two references<br>
to the vs_arr array seem to lead to a similar issue WRT the array<br>
elements (i.e. the vertex shaders).<br>
</blockquote></div>