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

Axel Davy axel.davy at ens.fr
Thu Oct 20 21:54:41 UTC 2016


For some reason, it introduces crashes. Not sure why.

I also figured out this doesn't free anything. There seems to be missing
code to free the 'nine_range_pool', and we leak at every device dtor.

Patch 1/2 is still an important fix to avoid leaks.

On 18/10/2016 23:11, Axel Davy wrote:
> 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])




More information about the mesa-dev mailing list