Commit 17bd40a5 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #3087 from kou/fix-segv-on-rerasing-no-memory-error

Fix SEGV on re-raising NoMemoryError
parents 70d24a9e 1d84b320
...@@ -215,6 +215,7 @@ mrb_realloc(mrb_state *mrb, void *p, size_t len) ...@@ -215,6 +215,7 @@ mrb_realloc(mrb_state *mrb, void *p, size_t len)
p2 = mrb_realloc_simple(mrb, p, len); p2 = mrb_realloc_simple(mrb, p, len);
if (!p2 && len) { if (!p2 && len) {
if (mrb->gc.out_of_memory) { if (mrb->gc.out_of_memory) {
mrb_exc_raise(mrb, mrb_obj_value(mrb->nomem_err));
/* mrb_panic(mrb); */ /* mrb_panic(mrb); */
} }
else { else {
......
...@@ -256,12 +256,13 @@ static void ...@@ -256,12 +256,13 @@ static void
cipop(mrb_state *mrb) cipop(mrb_state *mrb)
{ {
struct mrb_context *c = mrb->c; struct mrb_context *c = mrb->c;
struct REnv *env = c->ci->env;
if (c->ci->env) {
mrb_env_unshare(mrb, c->ci->env);
}
c->ci--; c->ci--;
if (env) {
mrb_env_unshare(mrb, env);
}
} }
void mrb_exc_set(mrb_state *mrb, mrb_value exc); void mrb_exc_set(mrb_state *mrb, mrb_value exc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment