diff options
Diffstat (limited to 'libc/upstream-dlmalloc')
-rw-r--r-- | libc/upstream-dlmalloc/malloc.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libc/upstream-dlmalloc/malloc.c b/libc/upstream-dlmalloc/malloc.c index 5e675b4..0a1f6b2 100644 --- a/libc/upstream-dlmalloc/malloc.c +++ b/libc/upstream-dlmalloc/malloc.c @@ -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; + } } /* |