| 202 | #define mi_track_page(page,access) { size_t psize; void* pstart = _mi_page_start(_mi_page_segment(page),page,&psize); mi_track_mem_##access( pstart, psize); } |
| 203 | |
| 204 | static inline bool mi_check_is_double_free(const mi_page_t* page, const mi_block_t* block) { |
| 205 | bool is_double_free = false; |
| 206 | mi_block_t* n = mi_block_nextx(page, block, page->keys); // pretend it is freed, and get the decoded first field |
| 207 | if (((uintptr_t)n & (MI_INTPTR_SIZE-1))==0 && // quick check: aligned pointer? |
| 208 | (n==NULL || mi_is_in_same_page(block, n))) // quick check: in same page or NULL? |
| 209 | { |
| 210 | // Suspicous: decoded value a in block is in the same page (or NULL) -- maybe a double free? |
| 211 | // (continue in separate function to improve code generation) |
| 212 | is_double_free = mi_check_is_double_freex(page, block); |
| 213 | } |
| 214 | return is_double_free; |
| 215 | } |
| 216 | #else |
| 217 | static inline bool mi_check_is_double_free(const mi_page_t* page, const mi_block_t* block) { |
| 218 | MI_UNUSED(page); |
nothing calls this directly
no test coverage detected