ruby-changes:38381
From: nobu <ko1@a...>
Date: Sun, 10 May 2015 21:33:06 +0900 (JST)
Subject: [ruby-changes:38381] nobu:r50462 (trunk): gc.c: never call dmark for NULL
nobu 2015-05-10 21:32:47 +0900 (Sun, 10 May 2015) New Revision: 50462 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50462 Log: gc.c: never call dmark for NULL * gc.c (gc_mark_children): call dmark function for non-NULL pointers only, so that DATA_PTR can be NULL safely now. Modified files: trunk/ChangeLog trunk/gc.c Index: ChangeLog =================================================================== --- ChangeLog (revision 50461) +++ ChangeLog (revision 50462) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun May 10 21:32:45 2015 Nobuyoshi Nakada <nobu@r...> + + * gc.c (gc_mark_children): call dmark function for non-NULL + pointers only, so that DATA_PTR can be NULL safely now. + Sun May 10 16:23:58 2015 Kazuki Tsujimoto <kazuki@c...> * proc.c (proc_binding): fix segmentation fault on marking phase. Index: gc.c =================================================================== --- gc.c (revision 50461) +++ gc.c (revision 50462) @@ -4300,12 +4300,14 @@ gc_mark_children(rb_objspace_t *objspace https://github.com/ruby/ruby/blob/trunk/gc.c#L4300 break; case T_DATA: - if (RTYPEDDATA_P(obj)) { - RUBY_DATA_FUNC mark_func = any->as.typeddata.type->function.dmark; - if (mark_func) (*mark_func)(DATA_PTR(obj)); - } - else { - if (any->as.data.dmark) (*any->as.data.dmark)(DATA_PTR(obj)); + { + void *const ptr = DATA_PTR(obj); + if (ptr) { + RUBY_DATA_FUNC mark_func = RTYPEDDATA_P(obj) ? + any->as.typeddata.type->function.dmark : + any->as.data.dmark; + if (mark_func) (*mark_func)(ptr); + } } break; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/