mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-04 09:30:00 +03:00
Fix a memory corruption bug in chunk_alloc_dss().
Fix a memory corruption bug in chunk_alloc_dss() that was due to claiming newly allocated memory is zeroed. Reverse order of preference between mmap() and sbrk() to prefer mmap(). Clean up management of 'zero' parameter in chunk_alloc*().
This commit is contained in:
parent
606f1fdc3c
commit
8f0e0eb1c0
6 changed files with 20 additions and 15 deletions
10
src/chunk.c
10
src/chunk.c
|
|
@ -125,16 +125,16 @@ chunk_alloc(size_t size, size_t alignment, bool base, bool *zero)
|
|||
ret = chunk_recycle(size, alignment, zero);
|
||||
if (ret != NULL)
|
||||
goto label_return;
|
||||
|
||||
ret = chunk_alloc_mmap(size, alignment, zero);
|
||||
if (ret != NULL)
|
||||
goto label_return;
|
||||
|
||||
if (config_dss) {
|
||||
ret = chunk_alloc_dss(size, alignment, zero);
|
||||
if (ret != NULL)
|
||||
goto label_return;
|
||||
}
|
||||
ret = chunk_alloc_mmap(size, alignment);
|
||||
if (ret != NULL) {
|
||||
*zero = true;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
/* All strategies for allocation failed. */
|
||||
ret = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue