mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 08:58:02 +02:00
winsys/radeon: Destroy fd_hash table when the last winsys is removed.
Fixes memory leak on module unload.
v2: Use util_hash_table helper function
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
(cherry picked from commit 45dfa6f4e7)
This commit is contained in:
parent
5fc5b1dab8
commit
5519bb3c65
1 changed files with 6 additions and 1 deletions
|
|
@ -719,8 +719,13 @@ static bool radeon_winsys_unref(struct radeon_winsys *ws)
|
|||
mtx_lock(&fd_tab_mutex);
|
||||
|
||||
destroy = pipe_reference(&rws->reference, NULL);
|
||||
if (destroy && fd_tab)
|
||||
if (destroy && fd_tab) {
|
||||
util_hash_table_remove(fd_tab, intptr_to_pointer(rws->fd));
|
||||
if (util_hash_table_count(fd_tab) == 0) {
|
||||
util_hash_table_destroy(fd_tab);
|
||||
fd_tab = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
mtx_unlock(&fd_tab_mutex);
|
||||
return destroy;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue