From a33549360d69b83435ef8b55d7fdd7bd8e9338f5 Mon Sep 17 00:00:00 2001 From: mame Date: Fri, 1 Aug 2008 12:30:25 +0000 Subject: * vm.c (Init_BareVM): check failure of malloc(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'vm.c') 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); -- cgit