check all os_commit calls and return NULL on failure

This commit is contained in:
Daan 2025-06-03 12:20:02 -07:00
parent 30a17bf1b7
commit 21425bc334
4 changed files with 27 additions and 14 deletions

View file

@ -300,7 +300,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