From b2995f8b399617d2aa31fac7e194c3ae598f60e9 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 28 Nov 2008 10:16:38 +0000 Subject: [PATCH] qi-fix-malloc-alignment.patch Noticed malloc() could become unaligned Signed-off-by: Andy Green --- qiboot/src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiboot/src/utils.c b/qiboot/src/utils.c index 3d72ec2..7e92288 100644 --- a/qiboot/src/utils.c +++ b/qiboot/src/utils.c @@ -271,7 +271,7 @@ void *malloc(size_t size) { void *p = malloc_pointer; - malloc_pointer += size; + malloc_pointer += (size & ~3) + 4; if (((u8 *)malloc_pointer - &malloc_pool[0]) > sizeof(malloc_pool)) { puts("Ran out of malloc pool\n");