Explorar o código

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

Ioannis Koutras %!s(int64=13) %!d(string=hai) anos
pai
achega
63e5ed26f2
Modificáronse 1 ficheiros con 1 adicións e 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);