rb_aligned_malloc can return NULL

Looking at gc.c, rb_aligned_malloc contains `return NULL;` so it
has to be taken care of.  Note however that posix_memalign(3posix)
does _not_ set errno.
This commit is contained in:
卜部昌平 2019-11-01 14:33:44 +09:00
Родитель 2c889e9b05
Коммит fb495b2928
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -294,6 +294,9 @@ transient_heap_block_alloc(struct transient_heap* theap)
#else
if (theap->arena == NULL) {
theap->arena = rb_aligned_malloc(TRANSIENT_HEAP_BLOCK_SIZE, TRANSIENT_HEAP_TOTAL_SIZE);
if (theap->arena == NULL) {
rb_bug("transient_heap_block_alloc: failed\n");
}
}
TH_ASSERT(theap->arena_index < TRANSIENT_HEAP_BLOCK_NUM);