lima: fix leak of the screen hash table

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12902>
This commit is contained in:
Christian Gmeiner 2021-09-16 18:52:39 +02:00 committed by Marge Bot
parent e7e762635d
commit f8a37832df
1 changed files with 7 additions and 1 deletions

View File

@ -47,8 +47,14 @@ lima_drm_screen_destroy(struct pipe_screen *pscreen)
mtx_lock(&lima_screen_mutex);
destroy = --screen->refcnt == 0;
if (destroy)
if (destroy) {
_mesa_hash_table_remove_key(fd_tab, intptr_to_pointer(fd));
if (!fd_tab->entries) {
_mesa_hash_table_destroy(fd_tab, NULL);
fd_tab = NULL;
}
}
mtx_unlock(&lima_screen_mutex);
if (destroy) {