use offsetof for allocator_state memory protection
parent
67ada4d309
commit
64e9f6797a
3
malloc.c
3
malloc.c
|
@ -777,8 +777,7 @@ COLD static void init_slow_path(void) {
|
||||||
if (allocator_state == NULL) {
|
if (allocator_state == NULL) {
|
||||||
fatal_error("failed to reserve allocator state");
|
fatal_error("failed to reserve allocator state");
|
||||||
}
|
}
|
||||||
if (memory_protect_rw(allocator_state, sizeof(allocator_state->size_class_metadata) +
|
if (memory_protect_rw(allocator_state, offsetof(struct allocator_state, regions_a))) {
|
||||||
sizeof(allocator_state->region_allocator))) {
|
|
||||||
fatal_error("failed to unprotect allocator state");
|
fatal_error("failed to unprotect allocator state");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue