u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fm: Fix a memory leak issue
@ 2021-06-02  6:35 Zhiqiang Hou
  2021-06-12 18:14 ` Ramon Fried
  0 siblings, 1 reply; 2+ messages in thread
From: Zhiqiang Hou @ 2021-06-02  6:35 UTC (permalink / raw)
  To: joe.hershberger, rfried.dev, priyanka.jain, u-boot; +Cc: Hou Zhiqiang

From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

Fix a memory leak issue in the RX port initialization.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
---
 drivers/net/fm/eth.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: fm: Fix a memory leak issue
  2021-06-02  6:35 [PATCH] net: fm: Fix a memory leak issue Zhiqiang Hou
@ 2021-06-12 18:14 ` Ramon Fried
  0 siblings, 0 replies; 2+ messages in thread
From: Ramon Fried @ 2021-06-12 18:14 UTC (permalink / raw)
  To: Zhiqiang Hou, joe.hershberger, priyanka.jain, u-boot

On Wed Jun 2, 2021 at 9:35 AM IDT, Zhiqiang Hou wrote:
> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
>
> Fix a memory leak issue in the RX port initialization.
>
> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> ---
> drivers/net/fm/eth.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> 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);
> --
> 2.17.1

Applied to u-boot-net/master, thanks!

Best regards,
Ramon Fried

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-12 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02  6:35 [PATCH] net: fm: Fix a memory leak issue Zhiqiang Hou
2021-06-12 18:14 ` Ramon Fried

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).