summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/dummy_malloc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/dummy_malloc.c b/common/dummy_malloc.c
index ab67120180..0120d9be2e 100644
--- a/common/dummy_malloc.c
+++ b/common/dummy_malloc.c
@@ -32,6 +32,11 @@ void *memalign(size_t alignment, size_t bytes)
{
void *mem = sbrk(bytes + alignment);
+ if (!mem) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
return PTR_ALIGN(mem, alignment);
}