Parcourir la source

core/mem: tlsf - cast to char* for pointer operations

Daniel-Constantin Mierla il y a 1 an
Parent
commit
d0a353342b
1 fichiers modifiés avec 4 ajouts et 3 suppressions
  1. 4 3
      src/core/mem/tlsf_malloc.c

+ 4 - 3
src/core/mem/tlsf_malloc.c

@@ -1058,9 +1058,10 @@ void tlsf_free(tlsf_t tlsf, void *ptr)
 		control->allocated -= block_size(block);
 		control->real_used -=
 				(block_size(block)
-						+ (ptr
-								- (void *)block
-								/* prev_phys_block is melted in the previous block when the current block is used */
+						+ ((char *)ptr
+								- (char *)block
+								/* prev_phys_block is melted in the previous
+								 * block when the current block is used */
 								+ sizeof(block->prev_phys_block)));
 #ifdef DBG_TLSF_MALLOC
 		block->alloc_info.file = file;