mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-08-24 08:14:48 +03:00
check all _mi_os_commit calls and return NULL if failing to commit
This commit is contained in:
parent
5c0effd421
commit
9232c5c8a0
5 changed files with 66 additions and 24 deletions
5
src/os.c
5
src/os.c
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue