board: freescale: Fix error handling in ls1088a board setup
- Add missing checks after calloc - Fix memory leak when handling calloc failure Signed-off-by: Francois Berder <fberder@outlook.fr> Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
committed by
Peng Fan
parent
a23a1e8ca5
commit
e672d4a472
@@ -948,7 +948,14 @@ int ft_board_setup(void *blob, struct bd_info *bd)
|
||||
total_memory_banks = CONFIG_NR_DRAM_BANKS + mc_memory_bank;
|
||||
|
||||
base = calloc(total_memory_banks, sizeof(u64));
|
||||
if (!base)
|
||||
return -ENOMEM;
|
||||
|
||||
size = calloc(total_memory_banks, sizeof(u64));
|
||||
if (!size) {
|
||||
free(base);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* fixup DT for the two GPP DDR banks */
|
||||
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
|
||||
|
||||
Reference in New Issue
Block a user