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

Fix SEGV on re-raising NoMemoryError
This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-01-19 17:36:51 +09:00
2 changed files with 6 additions and 4 deletions
+1
View File
@@ -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 {
+5 -4
View File
@@ -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);