Commit 63d53446 authored by Kuldeep Singh's avatar Kuldeep Singh Committed by Priyanka Jain
Browse files

net: pfe_eth: Fix resoure leak in pfe_spi_flash_init

Fix Coverity issue: RESOURCE_LEAK.
leaked_storage: Variable addr going out of scope leaks the storage it
points to.

Fixes: e0152dbe

 ("net: pfe_eth: Use spi_flash_read API to access
flash memory")
Signed-off-by: default avatarKuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: default avatarPriyanka Jain <priyanka.jain@nxp.com>
parent 450d4912
...@@ -170,6 +170,9 @@ int pfe_spi_flash_init(void) ...@@ -170,6 +170,9 @@ int pfe_spi_flash_init(void)
int ret = 0; int ret = 0;
void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH); void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH);
if (!addr)
return -ENOMEM;
#ifdef CONFIG_DM_SPI_FLASH #ifdef CONFIG_DM_SPI_FLASH
struct udevice *new; struct udevice *new;
...@@ -186,6 +189,7 @@ int pfe_spi_flash_init(void) ...@@ -186,6 +189,7 @@ int pfe_spi_flash_init(void)
#endif #endif
if (!pfe_flash) { if (!pfe_flash) {
printf("SF: probe for pfe failed\n"); printf("SF: probe for pfe failed\n");
free(addr);
return -ENODEV; return -ENODEV;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment