From: Yunjian Wang Date: Wed, 7 Oct 2020 07:36:46 +0000 (+0800) Subject: net/fm10k: fix memory leak when Tx thresh check fails X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9e4f075bc500dafe4568edf99b9a1161b554316e;p=dpdk.git net/fm10k: fix memory leak when Tx thresh check fails In fm10k_tx_queue_setup(), we allocate memory for the queue structure but not released when Tx thresh check fails. Fixes: 98068e0e044e ("fm10k: add Tx queue setup/release") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang Acked-by: Xiao Wang --- diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 3096370718..c4a6fdf7f0 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -2024,8 +2024,10 @@ fm10k_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, q->ops = &def_txq_ops; q->tail_ptr = (volatile uint32_t *) &((uint32_t *)hw->hw_addr)[FM10K_TDT(queue_id)]; - if (handle_txconf(q, conf)) + if (handle_txconf(q, conf)) { + rte_free(q); return -EINVAL; + } /* allocate memory for the software ring */ q->sw_ring = rte_zmalloc_socket("fm10k sw ring",