diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2021-11-12 14:37:16 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2021-11-12 17:36:39 +0900 |
commit | 415671a28273e5bfbe9aa00a0e386f025720ac23 (patch) | |
tree | f20952ce167ff86b3901cdb6ccd23dd5fe61aaf0 /parse.y | |
parent | 61938e2db59a032a46fc3de2ebead2e5e9d630a9 (diff) |
parse.y: Fix memory leak at parse error
Local variable tables might leak at the parse error.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5111
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 */ |