fix sized deallocation check with large sizes

The CONFIG_CXX_ALLOCATOR feature enables sanity checks for sized
deallocation and this wasn't updated to handle the introduction of
performing size class rounding for large sizes.
pull/131/head
Daniel Micay 2020-11-10 13:53:32 -05:00
parent 8d0314295e
commit b90f650153
1 changed files with 1 additions and 1 deletions

View File

@ -1235,7 +1235,7 @@ static void deallocate_large(void *p, const size_t *expected_size) {
fatal_error("invalid free"); fatal_error("invalid free");
} }
size_t size = region->size; size_t size = region->size;
if (expected_size && size != *expected_size) { if (expected_size && size != get_large_size_class(*expected_size)) {
fatal_error("sized deallocation mismatch (large)"); fatal_error("sized deallocation mismatch (large)");
} }
size_t guard_size = region->guard_size; size_t guard_size = region->guard_size;