Browse code

mem/tlsf: return a valid pointer for malloc(0)

for consistency with FM and QM allocators

Camille Oudot authored on 29/01/2016 14:46:59
Showing 1 changed files
... ...
@@ -960,7 +960,7 @@ void* tlsf_malloc(tlsf_t tlsf, size_t size)
960 960
 #endif
961 961
 {
962 962
 	control_t* control = tlsf_cast(control_t*, tlsf);
963
-	const size_t adjust = adjust_request_size(size, ALIGN_SIZE);
963
+	const size_t adjust = adjust_request_size(size?size:4, ALIGN_SIZE);
964 964
 	block_header_t* block = block_locate_free(control, adjust);
965 965
 #ifdef DBG_TLSF_MALLOC
966 966
 	void *ptr;