> -----Original Message-----
> From: Yu, DapengX <dapengx...@intel.com>
> Sent: Thursday, October 14, 2021 3:12 AM
> To: Singh, Jasvinder <jasvinder.si...@intel.com>; Dumitrescu, Cristian
> <cristian.dumitre...@intel.com>
> Cc: dev@dpdk.org; Yu, DapengX <dapengx...@intel.com>; sta...@dpdk.org
> Subject: [PATCH v2] net/softnic: fix memory leak of meter policy
>
> From: Dapeng Yu <dapengx...@intel.com>
>
> After the meter policies are created, they are not freed on device close.
>
> This patch fixes it.
>
> Fixes: 5f0d54f372f0 ("ethdev: add pre-defined meter policy API")
> Cc: sta...@dpdk.org
>
> Signed-off-by: Dapeng Yu <dapengx...@intel.com>
> ---
> V2:
> * Rebase on top of main branch
> ---
> drivers/net/softnic/rte_eth_softnic_meter.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/net/softnic/rte_eth_softnic_meter.c
> b/drivers/net/softnic/rte_eth_softnic_meter.c
> index 5831892a39..6b02f43e31 100644
> --- a/drivers/net/softnic/rte_eth_softnic_meter.c
> +++ b/drivers/net/softnic/rte_eth_softnic_meter.c
> @@ -52,6 +52,18 @@ softnic_mtr_free(struct pmd_internals *p)
> TAILQ_REMOVE(&p->mtr.meter_profiles, mp, node);
> free(mp);
> }
> +
> + /* Remove meter policies */
> + for ( ; ; ) {
> + struct softnic_mtr_meter_policy *mp;
> +
> + mp = TAILQ_FIRST(&p->mtr.meter_policies);
> + if (mp == NULL)
> + break;
> +
> + TAILQ_REMOVE(&p->mtr.meter_policies, mp, node);
> + free(mp);
> + }
> }
>
> struct softnic_mtr_meter_profile *
> --
> 2.27.0
Acked-by: Jasvinder Singh <jasvinder.si...@intel.com>