From fb495b2928545e44cc9859f7cc743032d92ca9ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Fri, 1 Nov 2019 14:33:44 +0900 Subject: 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. --- transient_heap.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'transient_heap.c') diff --git a/transient_heap.c b/transient_heap.c index 6cdd34284f..6e9cf6440e 100644 --- a/transient_heap.c +++ b/transient_heap.c @@ -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); -- cgit v1.2.3