diff --git a/ChangeLog b/ChangeLog index 5ebbedf95b..3273cfbdab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Feb 19 22:37:42 2011 CHIKANAGA Tomoyuki + + * vm_insnhelper.c (vm_check_if_namespace): guard temporary object + from GC. + Sat Feb 19 06:36:27 2011 Aaron Patterson * lib/test/unit.rb: partial revert of r30849. [ruby-core:32864] diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 8cd066f532..139a2a24ab 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1135,13 +1135,15 @@ vm_get_const_base(const rb_iseq_t *iseq, const VALUE *lfp, const VALUE *dfp) static inline void vm_check_if_namespace(VALUE klass) { + VALUE str; switch (TYPE(klass)) { case T_CLASS: case T_MODULE: break; default: + str = rb_inspect(klass); rb_raise(rb_eTypeError, "%s is not a class/module", - RSTRING_PTR(rb_inspect(klass))); + RSTRING_PTR(RB_GC_GUARD(str))); } }