From: Yevhenii Kolesnikov Date: Thu, 25 Jul 2019 15:15:24 +0000 (+0300) Subject: main: unreference ATIFragmentShader program before creating new one X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=02ecf16a70bb32eaf8540c4625c568bd193020e4;p=mesa.git 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 --- 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,