summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2022-01-01 21:02:58 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2022-01-01 21:02:58 +0900
commit28ccc664e5dcd3f9d55173e9afde77c4705a9ab6 (patch)
tree73c2a5cc17c8258b3f0da7eba1c01140b7741148 /src
parent3de9ddfb395c03996066a5df6d22f901a4999de2 (diff)
downloadmruby-28ccc664e5dcd3f9d55173e9afde77c4705a9ab6.tar.gz
mruby-28ccc664e5dcd3f9d55173e9afde77c4705a9ab6.zip
proc.c: should not reference `irep` when copying failed.
It may cause broken reference count numbers.
Diffstat (limited to 'src')
-rw-r--r--src/proc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/proc.c b/src/proc.c
index e11cb7fec..01a69fbf1 100644
--- a/src/proc.c
+++ b/src/proc.c
@@ -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; */
}