From f5e406327200672f95d61c4ca4ffc9de03e6a5a7 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 15:56:02 +0900 Subject: ruby_mimmalloc can return NULL malloc can fail. Should treat such situations. --- cont.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cont.c') diff --git a/cont.c b/cont.c index bdd775a8cb..59e97474fc 100644 --- a/cont.c +++ b/cont.c @@ -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; -- cgit v1.2.3