[Mesa-stable] [Mesa-dev][PATCH v2 2/2] winsys/radeon: Destroy fd_hash table when the last winsys is removed.
Marek Olšák
maraeo at gmail.com
Thu May 10 00:17:10 UTC 2018
For the series:
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Wed, May 9, 2018 at 3:29 PM, Jan Vesely <jan.vesely at rutgers.edu> wrote:
> Fixes memory leak on module unload.
> v2: Use util_hash_table helper function
>
> CC: <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
> src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
> b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
> index 3ee243adbc..253dd4e2eb 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;
> --
> 2.17.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20180509/7769d6d7/attachment.html>
More information about the mesa-stable
mailing list