[前][次][番号順一覧][スレッド一覧]

ruby-changes:6790

From: mame <ko1@a...>
Date: Fri, 1 Aug 2008 21:30:40 +0900 (JST)
Subject: [ruby-changes:6790] Ruby:r18306 (trunk): * vm.c (Init_BareVM): check failure of malloc().

mame	2008-08-01 21:30:25 +0900 (Fri, 01 Aug 2008)

  New Revision: 18306

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18306

  Log:
    * vm.c (Init_BareVM): check failure of malloc().

  Modified files:
    trunk/ChangeLog
    trunk/vm.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18305)
+++ ChangeLog	(revision 18306)
@@ -1,5 +1,8 @@
+Fri Aug  1 21:29:56 2008  Yusuke Endoh  <mame@t...>
+
+	* vm.c (Init_BareVM): check failure of malloc().
+
 Fri Aug  1 20:55:27 2008  NARUSE, Yui  <naruse@r...>
-
 	
 	* enc/trans/japanese.c (to_SHIFT_JIS_EF_BF_offsets): add U+FFF3,
 	  U+FFF4, U+FFF5.
Index: vm.c
===================================================================
--- vm.c	(revision 18305)
+++ vm.c	(revision 18306)
@@ -1851,6 +1851,10 @@
     /* 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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]