summaryrefslogtreecommitdiff
path: root/payloads/libpayload/libc/malloc.c
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2009-07-31 11:39:55 +0000
committerStefan Reinauer <stepan@openbios.org>2009-07-31 11:39:55 +0000
commit5fe6e23c61bf1fde7a1a0568b38d32c4e625f0ef (patch)
tree74ab1bde640908166368985f9598517756df3199 /payloads/libpayload/libc/malloc.c
parent131c0070a3b224e8ec2c817444f1ae4cf2419193 (diff)
downloadcoreboot-5fe6e23c61bf1fde7a1a0568b38d32c4e625f0ef.tar.xz
Catch various cases in libpayload where malloc() or memalign() return NULL
Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4474 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/libc/malloc.c')
-rw-r--r--payloads/libpayload/libc/malloc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/payloads/libpayload/libc/malloc.c b/payloads/libpayload/libc/malloc.c
index d18b289adf..4cb71f6ff4 100644
--- a/payloads/libpayload/libc/malloc.c
+++ b/payloads/libpayload/libc/malloc.c
@@ -309,6 +309,8 @@ void *memalign(size_t align, size_t size)
if (size == 0) return 0;
if (align_regions == 0) {
align_regions = malloc(sizeof(struct align_region_t));
+ if (align_regions == NULL)
+ return NULL;
memset(align_regions, 0, sizeof(struct align_region_t));
}
struct align_region_t *reg = align_regions;