[Mesa-dev] [PATCH] st/mesa: don't leak glsl_to_tgsi object on link failure

Ilia Mirkin imirkin at alum.mit.edu
Sun May 17 14:43:26 PDT 2015


On Sun, May 17, 2015 at 5:37 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On Sunday, May 17, 2015 05:32:24 PM Ilia Mirkin wrote:
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> ---
>>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> index 74c1932..0c582f5 100644
>> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> @@ -5736,6 +5736,7 @@ get_mesa_program(struct gl_context *ctx,
>>      */
>>     _mesa_associate_uniform_storage(ctx, shader_program, prog->Parameters);
>>     if (!shader_program->LinkStatus) {
>> +      free_glsl_to_tgsi_visitor(v);
>>        return NULL;
>>     }
>>
>>
>
> Huh, seems odd that st_program holds on to the visitor itself, rather
> than some data structure produced by it.  But I guess it works...

It was like that when I got there :)

An alternative way to deal with this, btw, is to move the if
(!LinkStatus) below the assignments, that way the prog (which doesn't
seem to get leaked) will handle deleting them when it's deleted. But
didn't seem to be important to hold on to the visitor if the program's
broken.

Chasing some weird leak where the visitor's not being deleted... this
isn't it, but just happened to notice it.

>
> This is clearly right, at any rate.
>
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

Thanks!


More information about the mesa-dev mailing list