From b90f650153c677fc3a95f80f747987a828d3bdf3 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Tue, 10 Nov 2020 13:53:32 -0500 Subject: [PATCH] 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. --- h_malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/h_malloc.c b/h_malloc.c index feb8d57..48cf7e5 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -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;