Index: uspace/lib/c/generic/malloc.c
===================================================================
--- uspace/lib/c/generic/malloc.c	(revision e06e27166f1b30422fc5f34049108ea34cdd2cfb)
+++ uspace/lib/c/generic/malloc.c	(revision f2a45d9dfce1c48cd7ca84792b0eedb9b0920ac8)
@@ -79,4 +79,8 @@
 	(sizeof(heap_block_head_t) + sizeof(heap_block_foot_t))
 
+/** Overhead of each area. */
+#define AREA_OVERHEAD(size) \
+	(ALIGN_UP(size + sizeof(heap_area_t), BASE_ALIGN))
+
 /** Calculate real size of a heap block.
  *
@@ -183,5 +187,5 @@
 
 /** Next heap block to examine (next fit algorithm) */
-static heap_block_head_t *next = NULL;
+static heap_block_head_t *next_fit = NULL;
 
 /** Futex for thread-safe heap manipulation */
@@ -378,5 +382,5 @@
 	
 	/* Eventually try to create a new area */
-	return area_create(AREA_FIRST_BLOCK_HEAD(size));
+	return area_create(AREA_OVERHEAD(size));
 }
 
@@ -455,8 +459,5 @@
 			/* Update heap area parameters */
 			area->end = end;
-			
-			/* Update block layout */
-			void *last = (void *) last_head;
-			size_t excess = (size_t) (area->end - last);
+			size_t excess = ((size_t) area->end) - ((size_t) last_head);
 			
 			if (excess > 0) {
@@ -467,5 +468,5 @@
 					 * create a new free block.
 					 */
-					block_init(last, excess, true, area);
+					block_init((void *) last_head, excess, true, area);
 				} else {
 					/*
@@ -486,5 +487,5 @@
 	}
 	
-	next = NULL;
+	next_fit = NULL;
 }
 
@@ -575,5 +576,5 @@
 				split_mark(cur, real_size);
 				
-				next = cur;
+				next_fit = cur;
 				return addr;
 			} else {
@@ -627,5 +628,5 @@
 						split_mark(next_head, real_size);
 						
-						next = next_head;
+						next_fit = next_head;
 						return aligned;
 					} else {
@@ -653,5 +654,5 @@
 							split_mark(cur, real_size);
 							
-							next = cur;
+							next_fit = cur;
 							return aligned;
 						}
@@ -691,5 +692,5 @@
 	
 	/* Try the next fit approach */
-	split = next;
+	split = next_fit;
 	
 	if (split != NULL) {
@@ -847,5 +848,5 @@
 			
 			ptr = ((void *) head) + sizeof(heap_block_head_t);
-			next = NULL;
+			next_fit = NULL;
 		} else
 			reloc = true;
