<div dir="ltr"><div><div>For the series:<br><br></div>Reviewed-by: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>><br><br></div>Marek<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 9, 2018 at 3:29 PM, Jan Vesely <span dir="ltr"><<a href="mailto:jan.vesely@rutgers.edu" target="_blank">jan.vesely@rutgers.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Fixes memory leak on module unload.<br>
v2: Use util_hash_table helper function<br>
<br>
CC: <<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.<wbr>freedesktop.org</a>><br>
Signed-off-by: Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a>><br>
---<br>
src/gallium/winsys/radeon/drm/<wbr>radeon_drm_winsys.c | 7 ++++++-<br>
1 file changed, 6 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/gallium/winsys/radeon/<wbr>drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/<wbr>drm/radeon_drm_winsys.c<br>
index 3ee243adbc..253dd4e2eb 100644<br>
--- a/src/gallium/winsys/radeon/<wbr>drm/radeon_drm_winsys.c<br>
+++ b/src/gallium/winsys/radeon/<wbr>drm/radeon_drm_winsys.c<br>
@@ -719,8 +719,13 @@ static bool radeon_winsys_unref(struct radeon_winsys *ws)<br>
mtx_lock(&fd_tab_mutex);<br>
<br>
destroy = pipe_reference(&rws-><wbr>reference, NULL);<br>
- if (destroy && fd_tab)<br>
+ if (destroy && fd_tab) {<br>
util_hash_table_remove(fd_tab, intptr_to_pointer(rws->fd));<br>
+ if (util_hash_table_count(fd_tab) == 0) {<br>
+ util_hash_table_destroy(fd_<wbr>tab);<br>
+ fd_tab = NULL;<br>
+ }<br>
+ }<br>
<br>
mtx_unlock(&fd_tab_mutex);<br>
return destroy;<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.17.0<br>
<br>
</font></span></blockquote></div><br></div>