Browse Source

sys_alloc should return the address of data block, not the address of the header.

Ioannis Koutras 13 years ago
parent
commit
63e5ed26f2
1 changed files with 1 additions and 0 deletions
  1. 1 0
      sys_alloc.c

+ 1 - 0
sys_alloc.c

@@ -15,6 +15,7 @@ void *sys_alloc(heap_t *heap, size_t size) {
 	allocation_size = req_padding(size) + HEADER_SIZE;
 	allocation_size = req_padding(size) + HEADER_SIZE;
 
 
 	ptr = sbrk((int) allocation_size);
 	ptr = sbrk((int) allocation_size);
+	ptr = (void *) ((char *) ptr + HEADER_SIZE);
 
 
 	set_size(ptr, req_padding(size));
 	set_size(ptr, req_padding(size));
 	set_requested_size(ptr, size);
 	set_requested_size(ptr, size);