diff options
author | Hou Zhiqiang <Zhiqiang.Hou@nxp.com> | 2021-06-12 21:15:41 +0300 |
---|---|---|
committer | Ramon Fried <rfried.dev@gmail.com> | 2021-06-18 11:29:17 +0300 |
commit | 3e1848778c068bddd442855792d478eb2f038665 (patch) | |
tree | 1805753a3a6d09552ece9c57ffa173488fce4fed /drivers/net/fm | |
parent | a298d4fbcdba1b38e48ea2af0fc5386cab2070da (diff) | |
download | u-boot-3e1848778c068bddd442855792d478eb2f038665.zip u-boot-3e1848778c068bddd442855792d478eb2f038665.tar.gz u-boot-3e1848778c068bddd442855792d478eb2f038665.tar.bz2 |
Fix a memory leak issue in the RX port initialization.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'drivers/net/fm')
-rw-r--r-- | drivers/net/fm/eth.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c index 0e89e66..7c23ccc 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); |