Avoid copying over initialized procs using initialize_copy; fix #3803

It may be better to raise exceptions, but CRuby doesn't.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-09-01 06:50:24 +09:00
parent 57610091ce
commit ab99e2c293
+4
View File
@@ -139,6 +139,10 @@ mrb_proc_cfunc_env_get(mrb_state *mrb, mrb_int idx)
void
mrb_proc_copy(struct RProc *a, struct RProc *b)
{
if (a->body.irep) {
/* already initialized proc */
return;
}
a->flags = b->flags;
a->body = b->body;
if (!MRB_PROC_CFUNC_P(a) && a->body.irep) {