diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-01-19 17:36:51 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-01-19 17:36:51 +0900 |
| commit | 17bd40a566f5220c01fdb68e760e897d6d87c43a (patch) | |
| tree | e410b5af1198dbed9ae7acd5741cd8af35e27abc | |
| parent | 70d24a9e5f501d3f237605f1c48a0ebb934a0ce9 (diff) | |
| parent | 1d84b3205ae1b8bc5b8a269ffeb5a7f60e610ea6 (diff) | |
| download | mruby-17bd40a566f5220c01fdb68e760e897d6d87c43a.tar.gz mruby-17bd40a566f5220c01fdb68e760e897d6d87c43a.zip | |
Merge pull request #3087 from kou/fix-segv-on-rerasing-no-memory-error
Fix SEGV on re-raising NoMemoryError
| -rw-r--r-- | src/gc.c | 1 | ||||
| -rw-r--r-- | src/vm.c | 9 |
2 files changed, 6 insertions, 4 deletions
@@ -215,6 +215,7 @@ mrb_realloc(mrb_state *mrb, void *p, size_t len) p2 = mrb_realloc_simple(mrb, p, len); if (!p2 && len) { if (mrb->gc.out_of_memory) { + mrb_exc_raise(mrb, mrb_obj_value(mrb->nomem_err)); /* mrb_panic(mrb); */ } else { @@ -256,12 +256,13 @@ static void cipop(mrb_state *mrb) { struct mrb_context *c = mrb->c; - - if (c->ci->env) { - mrb_env_unshare(mrb, c->ci->env); - } + struct REnv *env = c->ci->env; c->ci--; + + if (env) { + mrb_env_unshare(mrb, env); + } } void mrb_exc_set(mrb_state *mrb, mrb_value exc); |
