Skip to content

Commit

Permalink
proc.c: should not reference irep when copying failed.
Browse files Browse the repository at this point in the history
It may cause broken reference count numbers.
  • Loading branch information
matz committed Jan 1, 2022
1 parent 3de9ddf commit 28ccc66
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ mrb_proc_copy(mrb_state *mrb, struct RProc *a, struct RProc *b)
/* already initialized proc */
return;
}
if (!MRB_PROC_CFUNC_P(b) && b->body.irep) {
mrb_irep_incref(mrb, (mrb_irep*)b->body.irep);
}
a->flags = b->flags;
a->body = b->body;
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.target_class = a->e.target_class; */
}
Expand Down

0 comments on commit 28ccc66

Please # to comment.