fix possible underflow (issue #731)
This commit is contained in:
parent
b549c88e6c
commit
4cb5b45178
@ -1273,9 +1273,12 @@ void _mi_segment_huge_page_reset(mi_segment_t* segment, mi_page_t* page, mi_bloc
|
|||||||
mi_assert_internal(page->used == 1); // this is called just before the free
|
mi_assert_internal(page->used == 1); // this is called just before the free
|
||||||
mi_assert_internal(page->free == NULL);
|
mi_assert_internal(page->free == NULL);
|
||||||
if (segment->allow_decommit && page->is_committed) {
|
if (segment->allow_decommit && page->is_committed) {
|
||||||
const size_t usize = mi_usable_size(block) - sizeof(mi_block_t);
|
size_t usize = mi_usable_size(block);
|
||||||
uint8_t* p = (uint8_t*)block + sizeof(mi_block_t);
|
if (usize > sizeof(mi_block_t)) {
|
||||||
_mi_os_reset(p, usize, &_mi_stats_main);
|
usize = usize - sizeof(mi_block_t);
|
||||||
|
uint8_t* p = (uint8_t*)block + sizeof(mi_block_t);
|
||||||
|
_mi_os_reset(p, usize, &_mi_stats_main);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user