summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-01-30 06:37:45 -0800
committerYukihiro "Matz" Matsumoto <[email protected]>2013-01-30 06:37:45 -0800
commit184a721ae643bc1140997f2691378423bf046487 (patch)
tree382176701051f857d13cdaa3dca53f15adacb340 /src
parent7c813a9e15cb64cdaa6c8c47c84839357d6badcd (diff)
parent8ce1ea843738170d53cf627b7b7ff09e55076b85 (diff)
downloadmruby-184a721ae643bc1140997f2691378423bf046487.tar.gz
mruby-184a721ae643bc1140997f2691378423bf046487.zip
Merge pull request #803 from masamitsu-murase/protect_irep_of_ensure
Protect proc of ensure.
Diffstat (limited to 'src')
-rw-r--r--src/vm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vm.c b/src/vm.c
index ca31f6675..a2df8abdf 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -1236,6 +1236,12 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
acc = ci->acc;
pc = ci->pc;
regs = mrb->stack = mrb->stbase + ci->stackidx;
+ {
+ int idx = eidx;
+ while (idx > mrb->ci->eidx) {
+ mrb_gc_protect(mrb, mrb_obj_value(mrb->ensure[--idx]));
+ }
+ }
while (eidx > mrb->ci->eidx) {
ecall(mrb, --eidx);
}