radeonsi: fix leak when the in-memory cache is full

When the hw_binary is not put in the in-memory
cache it must be freed.

Fixes: 8283ed65cf ("radeonsi: Limit the size of the in-memory shader cache")

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9587>
This commit is contained in:
Axel Davy 2021-03-14 19:31:48 +01:00 committed by Marge Bot
parent 0c4ac28957
commit ff6f11acdc
1 changed files with 3 additions and 0 deletions

View File

@ -255,6 +255,9 @@ void si_shader_cache_insert_shader(struct si_screen *sscreen, unsigned char ir_s
disk_cache_compute_key(sscreen->disk_shader_cache, ir_sha1_cache_key, 20, key);
disk_cache_put(sscreen->disk_shader_cache, key, hw_binary, *((uint32_t *)hw_binary), NULL);
}
if (memory_cache_full)
FREE(hw_binary);
}
bool si_shader_cache_load_shader(struct si_screen *sscreen, unsigned char ir_sha1_cache_key[20],