diff --git a/ChangeLog b/ChangeLog index 814cefd514..fce9bb0421 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Jan 28 02:35:41 2011 KOSAKI Motohiro + + * hash.c (rb_hash_fetch_m): add GC guard to prevent intermediate + variable from GC. + Fri Jan 28 01:33:51 2011 KOSAKI Motohiro * test/ruby/test_process.rb (TestProcess#test_too_long_path) diff --git a/hash.c b/hash.c index c7ac394bcb..2e9d70dcc5 100644 --- a/hash.c +++ b/hash.c @@ -583,7 +583,7 @@ rb_hash_fetch_m(int argc, VALUE *argv, VALUE hash) if (!RHASH(hash)->ntbl || !st_lookup(RHASH(hash)->ntbl, key, &val)) { if (block_given) return rb_yield(key); if (argc == 1) { - VALUE desc = rb_protect(rb_inspect, key, 0); + volatile VALUE desc = rb_protect(rb_inspect, key, 0); if (NIL_P(desc) || RSTRING_LEN(desc) > 65) { desc = rb_any_to_s(key); }