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);