main: Fix memleaks in mesa_use_program
authorYevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Thu, 11 Jul 2019 10:00:46 +0000 (13:00 +0300)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 24 Jul 2019 16:54:21 +0000 (16:54 +0000)
Add freeing of SubroutineIndexes to the _mesa_free_shader_state.

Fixes: 4566aaaa5b1 ("mesa/subroutines: start adding per-context
subroutine index support (v1.1)")
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/main/shaderapi.c

index c057178bfa963e197ea92ced9a8f5f1581f07505..99eb2dc00e2979bc3753e97b2e8e3a7f11464437 100644 (file)
@@ -164,6 +164,8 @@ _mesa_free_shader_state(struct gl_context *ctx)
       _mesa_reference_shader_program(ctx,
                                      &ctx->Shader.ReferencedPrograms[i],
                                      NULL);
+      free(ctx->SubroutineIndex[i].IndexPtr);
+      ctx->SubroutineIndex[i].IndexPtr = NULL;
    }
    _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, NULL);