Permalink
Browse files

should not access scope after releasing memory pool

  • Loading branch information...
matz committed Dec 2, 2013
1 parent 155f390 commit 56a93a3357ab9f50a4105980e0b4d39e7d400e3b
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/codegen.c
View
@@ -87,12 +87,14 @@ static void codegen(codegen_scope *s, node *tree, int val);
static void
codegen_error(codegen_scope *s, const char *message)
{
jmp_buf jmp;
if (!s) return;
while (s->prev) {
codegen_scope *tmp = s->prev;
mrb_pool_close(s->mpool);
s = s->prev;
s = tmp;
}
mrb_pool_close(s->mpool);
#ifdef ENABLE_STDIO
if (s->filename && s->lineno) {
fprintf(stderr, "codegen error:%s:%d: %s\n", s->filename, s->lineno, message);
@@ -101,7 +103,9 @@ codegen_error(codegen_scope *s, const char *message)
fprintf(stderr, "codegen error: %s\n", message);
}
#endif
longjmp(s->jmp, 1);
memcpy(&jmp, &s->jmp, sizeof(jmp_buf));
mrb_pool_close(s->mpool);
longjmp(jmp, 1);
}
static void*

0 comments on commit 56a93a3

Please sign in to comment.