Browse Source

Fix: check if next block is free for coalescing three blocks.

Ioannis Koutras 13 years ago
parent
commit
c31e3b8c4c
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/custom_free.c

+ 1 - 1
src/custom_free.c

@@ -122,7 +122,7 @@ void custom_ahfree(allocator_t *allocator, heap_t* heap, void *ptr) {
         previous_current_size = (size_t) -1; /* SIZE_MAX */
     }
 
-    if(next_block != NULL && is_previous_free(ptr)) {
+    if(next_block != NULL && is_previous_free(ptr) && is_free(next_block)) {
 #ifdef WITH_OWNERSHIP
         if(get_owner(ptr) == get_owner(get_dlprevious(ptr) &&
             get_owner(ptr) == get_owner(next_block))) {