use offsetof for allocator_state memory protection

pull/65/head
Daniel Micay 2018-10-16 15:52:41 -04:00
parent 67ada4d309
commit 64e9f6797a
1 changed files with 1 additions and 2 deletions

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");
}