diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-11-01 14:33:44 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-11-01 16:58:19 +0900 |
commit | fb495b2928545e44cc9859f7cc743032d92ca9ee (patch) | |
tree | c8754f20eaa1a35653395bead3c70c9e6ed70dcf /transient_heap.c | |
parent | 2c889e9b05e2d2902096af02687cc6e3c7424c30 (diff) | |
download | ruby-fb495b2928545e44cc9859f7cc743032d92ca9ee.tar.gz |
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.
Diffstat (limited to 'transient_heap.c')
-rw-r--r-- | transient_heap.c | 3 |
1 files changed, 3 insertions, 0 deletions
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); |