diff --git a/src/gallium/auxiliary/util/u_live_shader_cache.c b/src/gallium/auxiliary/util/u_live_shader_cache.c index a32c3748257..15f387b4931 100644 --- a/src/gallium/auxiliary/util/u_live_shader_cache.c +++ b/src/gallium/auxiliary/util/u_live_shader_cache.c @@ -129,8 +129,11 @@ util_live_shader_cache_get(struct pipe_context *ctx, *cache_hit = (shader != NULL); /* Return if the shader already exists. */ - if (shader) + if (shader) { + if (state->type == PIPE_SHADER_IR_NIR) + ralloc_free(state->ir.nir); return shader; + } /* The cache mutex is unlocked to allow multiple create_shader * invocations to run simultaneously.