parse.y: Fix memory leak at parse error

Local variable tables might leak at the parse error.
This commit is contained in:
Yusuke Endoh 2021-11-12 14:37:16 +09:00
parent 61938e2db5
commit 415671a282
Notes: git 2021-11-12 17:37:04 +09:00
1 changed files with 6 additions and 0 deletions

View File

@ -6353,11 +6353,17 @@ yycompile(VALUE vparser, struct parser_params *p, VALUE fname, int line)
}
p->ruby_sourceline = line - 1;
p->lvtbl = NULL;
p->ast = ast = rb_ast_new();
rb_suppress_tracing(yycompile0, (VALUE)p);
p->ast = 0;
RB_GC_GUARD(vparser); /* prohibit tail call optimization */
while (p->lvtbl) {
local_pop(p);
}
return ast;
}
#endif /* !RIPPER */