check all _mi_os_commit calls and return NULL if failing to commit

This commit is contained in:
Daan 2025-06-03 12:20:02 -07:00
parent 5c0effd421
commit 9232c5c8a0
5 changed files with 66 additions and 24 deletions

View file

@ -288,7 +288,10 @@ static void* mi_os_prim_alloc_aligned(size_t size, size_t alignment, bool commit
// explicitly commit only the aligned part
if (commit) {
_mi_os_commit(p, size, NULL);
if (!_mi_os_commit(p, size, NULL)) {
mi_os_prim_free(p, over_size, 0);
return NULL;
}
}
}
else { // mmap can free inside an allocation