Skip to content

Commit

Permalink
rb_aligned_malloc can return NULL
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
shyouhei committed Nov 1, 2019
1 parent 2c889e9 commit fb495b2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions transient_heap.c
Expand Up @@ -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);
Expand Down

0 comments on commit fb495b2

Please sign in to comment.