Mesa (master): main: Fix memleaks in mesa_use_program

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 24 17:11:43 UTC 2019


Module: Mesa
Branch: master
Commit: 882fe09a74b4438cb3093ed0cd6d9525f30c3f84
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=882fe09a74b4438cb3093ed0cd6d9525f30c3f84

Author: Yevhenii Kolesnikov <yevhenii.kolesnikov at globallogic.com>
Date:   Thu Jul 11 13:00:46 2019 +0300

main: Fix memleaks in mesa_use_program

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 at globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/mesa/main/shaderapi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index c057178bfa9..99eb2dc00e2 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -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);
 




More information about the mesa-commit mailing list