Skip to content

Commit

Permalink
move mrb_str_dup() to mrb_class_path; ref #2470
Browse files Browse the repository at this point in the history
Class#to_s used to return same string repeatedly,
that mean you can modify "class name" by modifying
the return value from Class#to_s.
  • Loading branch information
matz committed Nov 13, 2016
1 parent 01dddaf commit 1422e57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ mrb_class_path(mrb_state *mrb, struct RClass *c)
}
mrb_obj_iv_set(mrb, (struct RObject*)c, classpath, path);
}
return path;
return mrb_str_dup(mrb, path);
}

MRB_API struct RClass *
Expand Down

0 comments on commit 1422e57

Please sign in to comment.