From 02ecf16a70bb32eaf8540c4625c568bd193020e4 Mon Sep 17 00:00:00 2001 From: Yevhenii Kolesnikov Date: Thu, 25 Jul 2019 18:15:24 +0300 Subject: [PATCH] main: unreference ATIFragmentShader program before creating new one Old program was overwritten without release of memory. Signed-off-by: Yevhenii Kolesnikov Reviewed-by: Lionel Landwerlin --- src/mesa/main/atifragshader.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/atifragshader.c b/src/mesa/main/atifragshader.c index a9356ae95b1..71c8ce5efdf 100644 --- a/src/mesa/main/atifragshader.c +++ b/src/mesa/main/atifragshader.c @@ -411,7 +411,10 @@ _mesa_EndFragmentShaderATI(void) if (ctx->Driver.NewATIfs) { struct gl_program *prog = ctx->Driver.NewATIfs(ctx, ctx->ATIFragmentShader.Current); - _mesa_reference_program(ctx, &ctx->ATIFragmentShader.Current->Program, prog); + _mesa_reference_program(ctx, &ctx->ATIFragmentShader.Current->Program, + NULL); + /* Don't use _mesa_reference_program(), just take ownership */ + ctx->ATIFragmentShader.Current->Program = prog; } if (!ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_SHADER_ATI, -- 2.30.2