Explorar el Código

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

Ioannis Koutras hace 13 años
padre
commit
63e5ed26f2
Se han modificado 1 ficheros con 1 adiciones y 0 borrados
  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);