[coreboot] [v2] r4475 - trunk/payloads/libpayload/libc

svn at coreboot.org svn at coreboot.org
Fri Jul 31 16:45:41 CEST 2009


Author: stepan
Date: 2009-07-31 16:45:41 +0200 (Fri, 31 Jul 2009)
New Revision: 4475

Modified:
   trunk/payloads/libpayload/libc/malloc.c
Log:
oops, these two were missed in the last cleanup.

Signed-off-by: Stefan Reinauer <stepan at coresystems.de>
Acked-by: Stefan Reinauer <stepan at coresystems.de>



Modified: trunk/payloads/libpayload/libc/malloc.c
===================================================================
--- trunk/payloads/libpayload/libc/malloc.c	2009-07-31 11:39:55 UTC (rev 4474)
+++ trunk/payloads/libpayload/libc/malloc.c	2009-07-31 14:45:41 UTC (rev 4475)
@@ -271,8 +271,14 @@
 static struct align_region_t *allocate_region(struct align_region_t *old_first, int alignment, int num_elements)
 {
 	struct align_region_t *new_region = malloc(sizeof(struct align_region_t));
+	if (!new_region)
+		return NULL;
 	new_region->alignment = alignment;
 	new_region->start = malloc((num_elements+1) * alignment + num_elements);
+	if (!new_region->start) {
+		free(new_region);
+		return NULL;
+	}
 	new_region->start_data = (void*)((u32)(new_region->start + num_elements + alignment - 1) & (~(alignment-1)));
 	new_region->size = num_elements * alignment;
 	new_region->free = num_elements;





More information about the coreboot mailing list