mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-08-24 08:14:48 +03:00
check all os_commit calls and return NULL on failure
This commit is contained in:
parent
1c51484799
commit
60f7e6a6a8
4 changed files with 27 additions and 14 deletions
5
src/os.c
5
src/os.c
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue