Fix OOM handling in memalign() and valloc().
Fix memalign() and valloc() to heed imemalign()'s return value. Reported by Kurt Wampler.
This commit is contained in:
parent
24057f3da8
commit
44b57b8e8b
@ -1751,7 +1751,8 @@ void *
|
|||||||
je_memalign(size_t alignment, size_t size)
|
je_memalign(size_t alignment, size_t size)
|
||||||
{
|
{
|
||||||
void *ret JEMALLOC_CC_SILENCE_INIT(NULL);
|
void *ret JEMALLOC_CC_SILENCE_INIT(NULL);
|
||||||
imemalign(&ret, alignment, size, 1);
|
if (unlikely(imemalign(&ret, alignment, size, 1) != 0))
|
||||||
|
ret = NULL;
|
||||||
JEMALLOC_VALGRIND_MALLOC(ret != NULL, ret, size, false);
|
JEMALLOC_VALGRIND_MALLOC(ret != NULL, ret, size, false);
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
@ -1762,7 +1763,8 @@ void *
|
|||||||
je_valloc(size_t size)
|
je_valloc(size_t size)
|
||||||
{
|
{
|
||||||
void *ret JEMALLOC_CC_SILENCE_INIT(NULL);
|
void *ret JEMALLOC_CC_SILENCE_INIT(NULL);
|
||||||
imemalign(&ret, PAGE, size, 1);
|
if (unlikely(imemalign(&ret, PAGE, size, 1) != 0))
|
||||||
|
ret = NULL;
|
||||||
JEMALLOC_VALGRIND_MALLOC(ret != NULL, ret, size, false);
|
JEMALLOC_VALGRIND_MALLOC(ret != NULL, ret, size, false);
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user