瀏覽代碼

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

Ioannis Koutras 13 年之前
父節點
當前提交
90d2a437f6
共有 1 個文件被更改,包括 4 次插入0 次删除
  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