Skip to content

Commit

Permalink
net/softnic: fix memory leak of meter policy
Browse files Browse the repository at this point in the history
After the meter policies are created, they are not freed on device
close.

This patch fixes it.

Fixes: 5f0d54f ("ethdev: add pre-defined meter policy API")
Cc: [email protected]

Signed-off-by: Dapeng Yu <[email protected]>
Acked-by: Jasvinder Singh <[email protected]>
  • Loading branch information
yudapengx authored and Ferruh Yigit committed Oct 19, 2021
1 parent b314a4a commit 287ca31
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/net/softnic/rte_eth_softnic_meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down

0 comments on commit 287ca31

Please sign in to comment.