diff options
author | Jan Vesely <[email protected]> | 2018-05-08 01:39:04 -0400 |
---|---|---|
committer | Jan Vesely <[email protected]> | 2018-05-10 05:12:48 -0400 |
commit | 45dfa6f4e77fbb21f312eb6101db6c25acd4d483 (patch) | |
tree | fb2c2b60cc07c08f592dbf38568ac490f6b3639d /src/gallium/winsys | |
parent | d146768d139f887105464f0db5600dd046452a8f (diff) |
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: <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Signed-off-by: Jan Vesely <[email protected]>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index 3ee243adbcc..253dd4e2eb6 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -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; |