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>
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index 1f79412..34b6fff 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -378,7 +378,10 @@
state->ram_size = CONFIG_SYS_SDRAM_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);
/*