From 0a33ac5413d6217a30b70d4ec6e11389872616d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 30 Aug 2011 17:11:34 +0200 Subject: [PATCH] glsl_to_tgsi: fix more potential shader reference leaks The last one has been pointed out by Ian. --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 31750686e98..66fc00f8161 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5078,21 +5078,31 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) (struct gl_vertex_program *)linked_prog); ok = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, linked_prog); + if (!ok) { + _mesa_reference_vertprog(ctx, &prog->VertexProgram, NULL); + } break; case GL_FRAGMENT_SHADER: _mesa_reference_fragprog(ctx, &prog->FragmentProgram, (struct gl_fragment_program *)linked_prog); ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB, linked_prog); + if (!ok) { + _mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL); + } break; case GL_GEOMETRY_SHADER: _mesa_reference_geomprog(ctx, &prog->GeometryProgram, (struct gl_geometry_program *)linked_prog); ok = ctx->Driver.ProgramStringNotify(ctx, GL_GEOMETRY_PROGRAM_NV, linked_prog); + if (!ok) { + _mesa_reference_geomprog(ctx, &prog->GeometryProgram, NULL); + } break; } if (!ok) { + _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program, NULL); _mesa_reference_program(ctx, &linked_prog, NULL); return GL_FALSE; } -- 2.30.2