Mesa (master): mesa: do not leak ctx->Shader.ReferencedProgram references
Timothy Arceri
tarceri at kemper.freedesktop.org
Fri May 25 00:38:19 UTC 2018
Module: Mesa
Branch: master
Commit: 6c61c31dc2fe52ad8a56ebe0b3aa10c223b635ba
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c61c31dc2fe52ad8a56ebe0b3aa10c223b635ba
Author: Jose Dapena Paz <jose.dapena at lge.com>
Date: Thu May 24 19:56:24 2018 +0200
mesa: do not leak ctx->Shader.ReferencedProgram references
When glUseProgram is used, references to the included shaders are
added in ctx->Shader.ReferencedProgram. But those references are not
decreased when the shader data is deallocated. Thus, those shaders
are leaked.
Explicitely remove the pending references to these shaders.
Fixes: e6506b3cd23 ("mesa: retain gl_shader_programs after glDeleteProgram if they are in use")
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
---
src/mesa/main/shaderapi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index caa42541ca..f7080847cc 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -159,6 +159,9 @@ _mesa_free_shader_state(struct gl_context *ctx)
{
for (int i = 0; i < MESA_SHADER_STAGES; i++) {
_mesa_reference_program(ctx, &ctx->Shader.CurrentProgram[i], NULL);
+ _mesa_reference_shader_program(ctx,
+ &ctx->Shader.ReferencedPrograms[i],
+ NULL);
}
_mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, NULL);
More information about the mesa-commit
mailing list