]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
Fix a memory leak issue in the RX port initialization.
authorHou Zhiqiang <Zhiqiang.Hou@nxp.com>
Sat, 12 Jun 2021 18:15:41 +0000 (21:15 +0300)
committerRamon Fried <rfried.dev@gmail.com>
Fri, 18 Jun 2021 08:29:17 +0000 (11:29 +0300)
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
drivers/net/fm/eth.c

index 0e89e663f716cbf977dd9707d6eb5f25c529243e..7c23ccc1f0e6e3405d3ab3db8cca90bb2012d880 100644 (file)
@@ -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);