浏览代码

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

Ioannis Koutras 13 年之前
父节点
当前提交
63e5ed26f2
共有 1 个文件被更改,包括 1 次插入0 次删除
  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;
 
 	ptr = sbrk((int) allocation_size);
+	ptr = (void *) ((char *) ptr + HEADER_SIZE);
 
 	set_size(ptr, req_padding(size));
 	set_requested_size(ptr, size);