From: Hou Zhiqiang Date: Sat, 12 Jun 2021 18:15:41 +0000 (+0300) Subject: Fix a memory leak issue in the RX port initialization. X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=3e1848778c068bddd442855792d478eb2f038665;p=u-boot.git Fix a memory leak issue in the RX port initialization. Signed-off-by: Hou Zhiqiang Reviewed-by: Ramon Fried --- diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c index 0e89e663f7..7c23ccc1f0 100644 --- a/drivers/net/fm/eth.c +++ b/drivers/net/fm/eth.c @@ -288,8 +288,10 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth) /* alloc Rx buffer from main memory */ rx_buf_pool = malloc(MAX_RXBUF_LEN * RX_BD_RING_SIZE); - if (!rx_buf_pool) + if (!rx_buf_pool) { + free(rx_bd_ring_base); return -ENOMEM; + } memset(rx_buf_pool, 0, MAX_RXBUF_LEN * RX_BD_RING_SIZE); debug("%s: rx_buf_pool = %p\n", __func__, rx_buf_pool);