<div dir="ltr"><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 Thu, May 10, 2018 at 7:27 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>
<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/amdgpu/drm/<wbr>amdgpu_winsys.c | 7 ++++++-<br>
1 file changed, 6 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/gallium/winsys/amdgpu/<wbr>drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/<wbr>drm/amdgpu_winsys.c<br>
index f4bbd3e732..84d8ca6fcf 100644<br>
--- a/src/gallium/winsys/amdgpu/<wbr>drm/amdgpu_winsys.c<br>
+++ b/src/gallium/winsys/amdgpu/<wbr>drm/amdgpu_winsys.c<br>
@@ -220,8 +220,13 @@ static bool amdgpu_winsys_unref(struct radeon_winsys *rws)<br>
simple_mtx_lock(&dev_tab_<wbr>mutex);<br>
<br>
destroy = pipe_reference(&ws->reference, NULL);<br>
- if (destroy && dev_tab)<br>
+ if (destroy && dev_tab) {<br>
util_hash_table_remove(dev_<wbr>tab, ws->dev);<br>
+ if (util_hash_table_count(dev_<wbr>tab) == 0) {<br>
+ util_hash_table_destroy(dev_<wbr>tab);<br>
+ dev_tab = NULL;<br>
+ }<br>
+ }<br>
<br>
simple_mtx_unlock(&dev_tab_<wbr>mutex);<br>
return destroy;<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.17.0<br>
<br>
</font></span></blockquote></div><br></div>