Add missing MALLOC_FAILURE_ACTION calls to dlmalloc.
Without these, sometimes malloc(3) returns NULL without setting errno. Change-Id: I4708c3f675bf2c878ddcaf012fde7848b255826b
This commit is contained in:
parent
1db615b4ae
commit
63deae5e4f
1 changed files with 10 additions and 2 deletions
|
@ -4049,12 +4049,20 @@ static void* sys_alloc(mstate m, size_t nb) {
|
|||
}
|
||||
|
||||
asize = granularity_align(nb + SYS_ALLOC_PADDING);
|
||||
if (asize <= nb)
|
||||
if (asize <= nb) {
|
||||
/* BEGIN android-added: set errno */
|
||||
MALLOC_FAILURE_ACTION;
|
||||
/* END android-added */
|
||||
return 0; /* wraparound */
|
||||
}
|
||||
if (m->footprint_limit != 0) {
|
||||
size_t fp = m->footprint + asize;
|
||||
if (fp <= m->footprint || fp > m->footprint_limit)
|
||||
if (fp <= m->footprint || fp > m->footprint_limit) {
|
||||
/* BEGIN android-added: set errno */
|
||||
MALLOC_FAILURE_ACTION;
|
||||
/* END android-added */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue