mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 05:31:32 +00:00
sandbox: handling out of memory
assert() only works in debug mode. So checking a successful memory allocation should not use assert(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
506d52308a
commit
c7e49ddc61
1 changed files with 4 additions and 1 deletions
|
@ -378,7 +378,10 @@ int state_init(void)
|
||||||
|
|
||||||
state->ram_size = CONFIG_SYS_SDRAM_SIZE;
|
state->ram_size = CONFIG_SYS_SDRAM_SIZE;
|
||||||
state->ram_buf = os_malloc(state->ram_size);
|
state->ram_buf = os_malloc(state->ram_size);
|
||||||
assert(state->ram_buf);
|
if (!state->ram_buf) {
|
||||||
|
printf("Out of memory\n");
|
||||||
|
os_exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
state_reset_for_test(state);
|
state_reset_for_test(state);
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue