소스 검색

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