mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-03 00:00:25 +01:00
glsl: avoid leaking linked gl_shader when there's a late linker error
This makes piglit mixing-clip-distance-and-clip-vertex-disallowed have 0
definitely lost blocks with valgrind. (Same non-0 number of possibly
lost blocks though.)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 5646f0f18a)
This commit is contained in:
parent
34ff020aea
commit
5eef18390d
1 changed files with 8 additions and 2 deletions
|
|
@ -2829,8 +2829,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:
|
||||
|
|
@ -2843,8 +2846,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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue