gallium/util: Fix leak in the live shader cache
authorAxel Davy <davyaxel0@gmail.com>
Sun, 10 May 2020 18:12:56 +0000 (20:12 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 11 May 2020 19:42:37 +0000 (19:42 +0000)
commit47bfc799da61aadd60ef9cc5c4bf0651c519cc77
treef1266c52d249ca0a7c69bca70e63757664867983
parent412e29c277774391c461d0f62c47e54d2f17814a
gallium/util: Fix leak in the live shader cache

When the nir backend is used, the create_shader
call is supposed to release state->ir.nir.
When the cache hits, create_shader is not called,
thus state->ir.nir should be freed.

There is nothing to be done for the TGSI case as the
tokens release is done by the caller.

This fixes a leak noticed in:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/2931

Fixes: 4bb919b0b8b4ed6f6a7049c3f8d294b74b50e198
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4980>
src/gallium/auxiliary/util/u_live_shader_cache.c