proc.c: should not reference `irep` when copying failed.

It may cause broken reference count numbers.
parent 3de9ddfb
...@@ -207,12 +207,12 @@ mrb_proc_copy(mrb_state *mrb, struct RProc *a, struct RProc *b) ...@@ -207,12 +207,12 @@ mrb_proc_copy(mrb_state *mrb, struct RProc *a, struct RProc *b)
/* already initialized proc */ /* already initialized proc */
return; return;
} }
if (!MRB_PROC_CFUNC_P(b) && b->body.irep) {
mrb_irep_incref(mrb, (mrb_irep*)b->body.irep);
}
a->flags = b->flags; a->flags = b->flags;
a->body = b->body; a->body = b->body;
a->upper = b->upper; a->upper = b->upper;
if (!MRB_PROC_CFUNC_P(a) && a->body.irep) {
mrb_irep_incref(mrb, (mrb_irep*)a->body.irep);
}
a->e.env = b->e.env; a->e.env = b->e.env;
/* a->e.target_class = a->e.target_class; */ /* a->e.target_class = a->e.target_class; */
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment