From: Yunjian Wang Date: Mon, 28 Sep 2020 12:44:42 +0000 (+0800) Subject: net/fm10k: fix memory leak when thresh check fails X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=c87a6de2a130c436fcf73b27f829c48e8249bcc4;p=dpdk.git net/fm10k: fix memory leak when thresh check fails In fm10k_rx_queue_setup(), we allocate memory for the queue structure but not released when thresh check fails. Fixes: 6cfe8969c969 ("fm10k: add Rx queue setup/release") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang Acked-by: Qi Zhang --- diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 5771d83b55..98e396b8e7 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1841,9 +1841,10 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, q->tail_ptr = (volatile uint32_t *) &((uint32_t *)hw->hw_addr)[FM10K_RDT(queue_id)]; q->offloads = offloads; - if (handle_rxconf(q, conf)) + if (handle_rxconf(q, conf)) { + rte_free(q); return -EINVAL; - + } /* allocate memory for the software ring */ q->sw_ring = rte_zmalloc_socket("fm10k sw ring", (nb_desc + q->nb_fake_desc) * sizeof(struct rte_mbuf *),