mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-07-05 02:36:39 +09:00
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: e0152dbed6
("net: pfe_eth: Use spi_flash_read API to access
flash memory")
Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
This commit is contained in:
parent
450d491293
commit
63d5344615
|
@ -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)
|
||||||
#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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user