net/softnic: fix memory leak of meter policy

After the meter policies are created, they are not freed on device
close.

This patch fixes it.

Fixes: 5f0d54f372 ("ethdev: add pre-defined meter policy API")
Cc: stable@dpdk.org

Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
This commit is contained in:
Dapeng Yu 2021-10-14 10:12:07 +08:00 committed by Ferruh Yigit
parent b314a4a664
commit 287ca31bea

View File

@ -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 *