Mesa (main): freedreno: Fix leak of the screen hash table.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 22 20:55:44 UTC 2021
Module: Mesa
Branch: main
Commit: 56c7e69c4d9dca0e4e0f4c56dcfe97e8b8b4aa5e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=56c7e69c4d9dca0e4e0f4c56dcfe97e8b8b4aa5e
Author: Emma Anholt <emma at anholt.net>
Date: Tue Jun 22 12:09:44 2021 -0700
freedreno: Fix leak of the screen hash table.
Now we have no leaks detected on a run of a basic deqp test
(dEQP-GLES2.functional.shaders.constants.const_float_assignment_3_fragment).
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11537>
---
src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c b/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c
index 6773af41b18..211e1656429 100644
--- a/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c
+++ b/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c
@@ -54,6 +54,11 @@ fd_drm_screen_destroy(struct pipe_screen *pscreen)
if (destroy) {
int fd = fd_device_fd(screen->dev);
_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(&fd_screen_mutex);
More information about the mesa-commit
mailing list