> Subject: [PATCH v2 5/6] net/iavf: fix leak of flex metadata extraction field
> 
> Function iavf_init_proto_xtr() allocates vf->proto_xtr as part of the
> device init sequence, but no shutdown function frees this memory again.
> Add an appropriate free call to fix this memory leak.
> 
> Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")
> Cc: [email protected]
> 
> Signed-off-by: Bruce Richardson <[email protected]>
> ---
>  drivers/net/intel/iavf/iavf_ethdev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/intel/iavf/iavf_ethdev.c
> b/drivers/net/intel/iavf/iavf_ethdev.c
> index 1cd8c88384..7f5b103326 100644
> --- a/drivers/net/intel/iavf/iavf_ethdev.c
> +++ b/drivers/net/intel/iavf/iavf_ethdev.c
> @@ -2757,6 +2757,8 @@ iavf_uninit_vf(struct rte_eth_dev *dev)
>       vf->qos_cap = NULL;
>       free(vf->qtc_map);
>       vf->qtc_map = NULL;
> +     rte_free(vf->proto_xtr);
> +     vf->proto_xtr = NULL;

This function iavf_uninit_vf is only called when an error is encountered in
iavf_dev_init and we goto the init_vf_err label. We need to free the memory
in the successful case as well.

> 
>       rte_free(vf->rss_lut);
>       vf->rss_lut = NULL;
> --
> 2.53.0

Reply via email to