[Mesa-dev] [PATCH] glsl: avoid leaking linked gl_shader when there's a late linker error
Tobias Klausmann
tobias.johannes.klausmann at mni.thm.de
Mon May 25 13:28:51 PDT 2015
pong
the unhappyness case will hopefully soon be extended with cull_distance
+ clipvertex, so good to see this fixed!
Reviewed-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>
On 25.05.2015 21:42, Ilia Mirkin wrote:
> ping
>
> On Sun, May 17, 2015 at 5:56 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> ---
>>
>> Just happened to notice it... still not the leak I'm chasing :( The
>> only time this can happen is basically when it's unhappy about the
>> clip distance usage (i.e. clipvertex + clipdistance at the same time).
>>
>> src/glsl/linker.cpp | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
>> index 21cfc77..ce43f06 100644
>> --- a/src/glsl/linker.cpp
>> +++ b/src/glsl/linker.cpp
>> @@ -3269,8 +3269,11 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
>> link_intrastage_shaders(mem_ctx, ctx, prog, shader_list[stage],
>> num_shaders[stage]);
>>
>> - if (!prog->LinkStatus)
>> + if (!prog->LinkStatus) {
>> + if (sh)
>> + ctx->Driver.DeleteShader(ctx, sh);
>> goto done;
>> + }
>>
>> switch (stage) {
>> case MESA_SHADER_VERTEX:
>> @@ -3289,8 +3292,11 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
>> validate_fragment_shader_executable(prog, sh);
>> break;
>> }
>> - if (!prog->LinkStatus)
>> + if (!prog->LinkStatus) {
>> + if (sh)
>> + ctx->Driver.DeleteShader(ctx, sh);
>> goto done;
>> + }
>>
>> _mesa_reference_shader(ctx, &prog->_LinkedShaders[stage], sh);
>> }
>> --
>> 2.3.6
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list