Browse Source

If ptr on a free() call is NULL, no operation is performed.

Ioannis Koutras 13 years ago
parent
commit
90d2a437f6
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/custom_free.c

+ 4 - 0
src/custom_free.c

@@ -45,6 +45,10 @@ void custom_ahfree(allocator_t *allocator, heap_t* heap, void *ptr) {
     size_t three_blocks_size;
 #endif /* COALESCING_FIXED || COALESCING_VARIABLE */
 
+    if(ptr == NULL) {
+        return;
+    }
+
     size = get_size(ptr);
 
 #ifdef HAVE_LOCKS