use offsetof for allocator_state memory protection

This commit is contained in:
Daniel Micay 2018-10-16 15:52:41 -04:00
parent 67ada4d309
commit 64e9f6797a

View File

@ -777,8 +777,7 @@ COLD static void init_slow_path(void) {
if (allocator_state == NULL) {
fatal_error("failed to reserve allocator state");
}
if (memory_protect_rw(allocator_state, sizeof(allocator_state->size_class_metadata) +
sizeof(allocator_state->region_allocator))) {
if (memory_protect_rw(allocator_state, offsetof(struct allocator_state, regions_a))) {
fatal_error("failed to unprotect allocator state");
}