From ccf0f002d2ec5455102c0259f44535944aa4b154 Mon Sep 17 00:00:00 2001 From: Dapeng Yu Date: Wed, 15 Sep 2021 13:08:02 +0800 Subject: [PATCH] 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) --- drivers/net/bonding/rte_eth_bond_pmd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; -- 2.20.1