[Mesa-dev] [PATCH] nir/clone: Free clone_state after use (to fix memory leak)

Eduardo Lima Mitev elima at igalia.com
Mon Nov 20 08:35:57 UTC 2017


Ping? This patch fixes an active memory leak.

Any comments? Thanks.

Eduardo


On 11/14/2017 11:18 PM, Eduardo Lima Mitev wrote:
> In nir_cf_list_clone(), a state_clone object is initialized but never
> freed, causing a memory leak. If the remap_table argument is NULL,
> init_state will create a hash table for it, and that's what
> free_clone_state is supposed to free.
> ---
>   src/compiler/nir/nir_clone.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c
> index bcfdaa7594..c823acb6ee 100644
> --- a/src/compiler/nir/nir_clone.c
> +++ b/src/compiler/nir/nir_clone.c
> @@ -660,6 +660,9 @@ nir_cf_list_clone(nir_cf_list *dst, nir_cf_list *src, nir_cf_node *parent,
>      clone_cf_list(&state, &dst->list, &src->list);
>   
>      fixup_phi_srcs(&state);
> +
> +   if (!remap_table)
> +      free_clone_state(&state);
>   }
>   
>   static nir_function_impl *



More information about the mesa-dev mailing list