summaryrefslogtreecommitdiffhomepage
path: root/src/state.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-09-04 06:51:31 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-09-04 06:51:31 +0900
commit3acaa44a70a44a816076dee65310f0f2487aeebd (patch)
treedb7b29708bd51a1521d2695d0debdf562101d99a /src/state.c
parent8a5d783f2ee5ddccdb2b8de2edf5dc6b5ba1c3fc (diff)
downloadmruby-3acaa44a70a44a816076dee65310f0f2487aeebd.tar.gz
mruby-3acaa44a70a44a816076dee65310f0f2487aeebd.zip
Restructure `irep->outer` chain; fix #3804
Instead of `irep -> proc` chain, we use `irep -> irep` chain to avoid GC bugs like #3804. We added `target_class` reference to `mrb_irep` struct. That means one more word consumption per `irep`.
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/state.c b/src/state.c
index f09b20903..039d67d57 100644
--- a/src/state.c
+++ b/src/state.c
@@ -157,6 +157,8 @@ mrb_irep_free(mrb_state *mrb, mrb_irep *irep)
for (i=0; i<irep->rlen; i++) {
mrb_irep_decref(mrb, irep->reps[i]);
}
+ if (irep->outer)
+ mrb_irep_decref(mrb, irep->outer);
mrb_free(mrb, irep->reps);
mrb_free(mrb, irep->lv);
if (irep->own_filename) {