From: Dapeng Yu Date: Wed, 15 Sep 2021 05:08:02 +0000 (+0800) Subject: net/bonding: fix memory leak on closing device X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ccf0f002d2ec5455102c0259f44535944aa4b154;p=dpdk.git net/bonding: fix memory leak on closing device If the bond device was created by vdev mode, the kvlist was not free after the bond device was closed. This patch fixes it. Fixes: 144dc4739975 ("net/bonding: fix leak on remove") Cc: stable@dpdk.org Signed-off-by: Dapeng Yu Acked-by: Min Hu (Connor) --- diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 8ed9e036f4..54987d96b3 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2159,6 +2159,9 @@ bond_ethdev_close(struct rte_eth_dev *dev) */ rte_mempool_free(internals->mode6.mempool); + if (internals->kvlist != NULL) + rte_kvargs_free(internals->kvlist); + return 0; } @@ -3471,8 +3474,6 @@ bond_remove(struct rte_vdev_device *dev) ret = bond_ethdev_stop(eth_dev); bond_ethdev_close(eth_dev); } - if (internals->kvlist != NULL) - rte_kvargs_free(internals->kvlist); rte_eth_dev_release_port(eth_dev); return ret;