mirror of
https://github.com/espressif/tlsf.git
synced 2026-10-02 05:47:38 +00:00
Add heap poisoning mechanism to fill absorbed block header with the right pattern.
Note: block_absorb() is called in tlsf_free(), which is eventually called in multi_heap_free() after the memory fill is done. As the block_absorb merges 2 blocks together, the previous block header of the merged block is now in the middle of the memory block but not filled with 0xfe. - Remove dependencies with the heap component of the IDF. - The tlsf_poison_fill_region_hook() function is defined as weak in IDF and checked for NULL in block_absorb() function in order to minimize the dependencies between IDF and the TLSF. - The the implementation of tlsf_poison_fill_region_hook() must be provided at the discretion of the user.
This commit is contained in:
committed by
Guillaume Souchere
parent
1322e839d2
commit
b76f0fefd1
@@ -456,6 +456,12 @@ static inline __attribute__((always_inline)) block_header_t* block_absorb(block_
|
||||
/* Note: Leaves flags untouched. */
|
||||
prev->size += block_size(block) + block_header_overhead;
|
||||
block_link_next(prev);
|
||||
|
||||
if (block_absorb_post_hook != NULL)
|
||||
{
|
||||
block_absorb_post_hook(block, sizeof(block_header_t), POISONING_AFTER_FREE);
|
||||
}
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user