summaryrefslogtreecommitdiffstats
path: root/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index 6636a5225..25bf1b093 100644
--- a/vm.c
+++ b/vm.c
@@ -1851,6 +1851,10 @@ Init_BareVM(void)
/* VM bootstrap: phase 1 */
rb_vm_t * vm = malloc(sizeof(*vm));
rb_thread_t * th = malloc(sizeof(*th));
+ if (!vm || !th) {
+ fprintf(stderr, "[FATAL] failed to allocate memory\n");
+ exit(EXIT_FAILURE);
+ }
MEMZERO(th, rb_thread_t, 1);
rb_thread_set_current_raw(th);