summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorMiles Bader <miles@lsi.nec.co.jp>2003-09-19 10:10:33 +0000
committerMiles Bader <miles@lsi.nec.co.jp>2003-09-19 10:10:33 +0000
commita436319a3a1e288bfaa0eb79f7066e7290464ba8 (patch)
treefb0583ed8c31e6e86caa69dfea490b8fc60d2933 /libc
parent90d471bfdf2b13fa96b132dc5b35aa669a57480a (diff)
Make sure we don't allocate too little space for static free-areas
because of our fiddling with alignment (because doing so is VERY BAD).
Diffstat (limited to 'libc')
-rw-r--r--libc/stdlib/malloc/heap.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/libc/stdlib/malloc/heap.h b/libc/stdlib/malloc/heap.h
index 13e37ea6c..29a32c0bb 100644
--- a/libc/stdlib/malloc/heap.h
+++ b/libc/stdlib/malloc/heap.h
@@ -78,7 +78,9 @@ struct heap_free_area
#define HEAP_DECLARE_STATIC_FREE_AREA(name, size) \
static struct \
{ \
- HEAP_GRANULARITY_TYPE space[((size) - sizeof (struct heap_free_area)) \
+ HEAP_GRANULARITY_TYPE space[((size) \
+ - sizeof (struct heap_free_area) \
+ + (HEAP_GRANULARITY - 1)) \
/ HEAP_GRANULARITY]; \
struct heap_free_area _fa; \
} name = { { (HEAP_GRANULARITY_TYPE)0 }, { (size), 0, 0 } }