Kaynağa Gözat

The new block after a split should be the one to be set free and properly set of a heap owner.

Ioannis Koutras 14 yıl önce
ebeveyn
işleme
3c231f9a82
1 değiştirilmiş dosya ile 2 ekleme ve 1 silme
  1. 2 1
      src/split.c

+ 2 - 1
src/split.c

@@ -40,7 +40,8 @@ void split(allocator_t *allocator, heap_t *heap, void *ptr,
         heap->free_list_head = new_block;
     }
 
-    mark_free(ptr);
+    set_owner(new_block, heap);
+    mark_free(new_block);
 
     if(allocator->border_ptr == ptr) {
         allocator->border_ptr = new_block;