1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
parent 2c889e9b05
commit fb495b2928

View file

@ -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);