summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYevhenii Kolesnikov <[email protected]>2019-07-25 18:15:24 +0300
committerLionel Landwerlin <[email protected]>2019-07-26 12:51:05 +0000
commit02ecf16a70bb32eaf8540c4625c568bd193020e4 (patch)
tree81b2f8c4cf90f0585245a56111040a4c844a20d5
parentfad848094fc5f3a16e1de3885f185e1df8b1e70b (diff)
main: unreference ATIFragmentShader program before creating new one
Old program was overwritten without release of memory. Signed-off-by: Yevhenii Kolesnikov <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
-rw-r--r--src/mesa/main/atifragshader.c5
1 files changed, 4 insertions, 1 deletions
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,