zink: destroy shader modules on program free to avoid leaking

it's irrelevant whether the shader pointer is valid, the shader cache
may still exist

Fixes: a92442225c ("zink: split up shader cache per-stage")

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12650>
This commit is contained in:
Mike Blumenkrantz 2021-08-31 14:21:30 -04:00 committed by Marge Bot
parent eb7eccc76f
commit b7534fe82a

View file

@ -683,8 +683,8 @@ zink_destroy_gfx_program(struct zink_screen *screen,
if (prog->shaders[i]) {
_mesa_set_remove_key(prog->shaders[i]->programs, prog);
prog->shaders[i] = NULL;
destroy_shader_cache(screen, &prog->base.shader_cache[i]);
}
destroy_shader_cache(screen, &prog->base.shader_cache[i]);
ralloc_free(prog->nir[i]);
}