Skip to content

Commit

Permalink
fix sized deallocation check with large sizes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thestinger committed Nov 10, 2020
1 parent 8d03142 commit b90f650
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion h_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ static void deallocate_large(void *p, const size_t *expected_size) {
fatal_error("invalid free");
}
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)");
}
size_t guard_size = region->guard_size;
Expand Down

0 comments on commit b90f650

Please sign in to comment.