[07/20] net/bnx2x: add clean up for 'rxq' to avoid a memory leak

Message ID tencent_864A4480E8E07EBF8FE88844C558F1E89C0A@qq.com (mailing list archive)
State Changes Requested, archived
Delegated to: David Marchand
Headers
Series fix memory leaks in error handling |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Weiguo Li Feb. 22, 2022, 6:18 p.m. UTC
  This error handling miss a clean up for 'rxq' which leads to
a memory leak.

Fixes: 540a211084a7 ("bnx2x: driver core")

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
 drivers/net/bnx2x/bnx2x_rxtx.c | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index fbc0bb7698..9ad36000fb 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -139,6 +139,7 @@  bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	dma = ring_dma_zone_reserve(dev, "bnx2x_rcq", queue_idx, dma_size, socket_id);
 	if (NULL == dma) {
 		PMD_RX_LOG(ERR, "RCQ  alloc failed");
+		bnx2x_rx_queue_release(rxq);
 		return -ENOMEM;
 	}
 	fp->rx_comp_mapping = rxq->cq_ring_phys_addr = (uint64_t)dma->iova;