diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-11-01 15:56:02 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-11-01 16:58:19 +0900 |
commit | f5e406327200672f95d61c4ca4ffc9de03e6a5a7 (patch) | |
tree | eee27880c3ffd7fb2a433058ef75f2acdad96235 /cont.c | |
parent | fb495b2928545e44cc9859f7cc743032d92ca9ee (diff) |
ruby_mimmalloc can return NULL
malloc can fail. Should treat such situations.
Diffstat (limited to 'cont.c')
-rw-r--r-- | cont.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -1865,6 +1865,9 @@ void rb_threadptr_root_fiber_setup(rb_thread_t *th) { rb_fiber_t *fiber = ruby_mimmalloc(sizeof(rb_fiber_t)); + if (!fiber) { + rb_bug("%s", strerror(errno)); /* ... is it possible to call rb_bug here? */ + } MEMZERO(fiber, rb_fiber_t, 1); fiber->cont.type = FIBER_CONTEXT; fiber->cont.saved_ec.fiber_ptr = fiber; |