[Mesa-dev] [PATCH 2/2] st/nine: Fix leak at device dtor

Axel Davy axel.davy at ens.fr
Tue Oct 18 21:11:26 UTC 2016


The datastructures to track dirty constants
weren't freed.

Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/device9.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index c0a3c39..d7f3a40 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -481,6 +481,8 @@ void
 NineDevice9_dtor( struct NineDevice9 *This )
 {
     unsigned i;
+    struct nine_range *r;
+    struct nine_range_pool *pool = &This->base.device->range_pool;
 
     DBG("This=%p\n", This);
 
@@ -514,6 +516,23 @@ NineDevice9_dtor( struct NineDevice9 *This )
     FREE(This->state.vs_const_b);
     FREE(This->state.vs_const_f_swvp);
 
+    if (This->state.changed.ps_const_f) {
+        for (r = This->state.changed.ps_const_f; r->next; r = r->next);
+        nine_range_pool_put_chain(pool, This->state.changed.ps_const_f, r);
+    }
+    if (This->state.changed.vs_const_f) {
+        for (r = This->state.changed.vs_const_f; r->next; r = r->next);
+        nine_range_pool_put_chain(pool, This->state.changed.vs_const_f, r);
+    }
+    if (This->state.changed.vs_const_i) {
+        for (r = This->state.changed.vs_const_i; r->next; r = r->next);
+        nine_range_pool_put_chain(pool, This->state.changed.vs_const_i, r);
+    }
+    if (This->state.changed.vs_const_b) {
+        for (r = This->state.changed.vs_const_b; r->next; r = r->next);
+        nine_range_pool_put_chain(pool, This->state.changed.vs_const_b, r);
+    }
+
     if (This->swapchains) {
         for (i = 0; i < This->nswapchains; ++i)
             if (This->swapchains[i])
-- 
2.10.0



More information about the mesa-dev mailing list