mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: Fix memory leak at parse error
Local variable tables might leak at the parse error.
This commit is contained in:
parent
61938e2db5
commit
415671a282
Notes:
git
2021-11-12 17:37:04 +09:00
1 changed files with 6 additions and 0 deletions
6
parse.y
6
parse.y
|
@ -6353,11 +6353,17 @@ yycompile(VALUE vparser, struct parser_params *p, VALUE fname, int line)
|
||||||
}
|
}
|
||||||
p->ruby_sourceline = line - 1;
|
p->ruby_sourceline = line - 1;
|
||||||
|
|
||||||
|
p->lvtbl = NULL;
|
||||||
|
|
||||||
p->ast = ast = rb_ast_new();
|
p->ast = ast = rb_ast_new();
|
||||||
rb_suppress_tracing(yycompile0, (VALUE)p);
|
rb_suppress_tracing(yycompile0, (VALUE)p);
|
||||||
p->ast = 0;
|
p->ast = 0;
|
||||||
RB_GC_GUARD(vparser); /* prohibit tail call optimization */
|
RB_GC_GUARD(vparser); /* prohibit tail call optimization */
|
||||||
|
|
||||||
|
while (p->lvtbl) {
|
||||||
|
local_pop(p);
|
||||||
|
}
|
||||||
|
|
||||||
return ast;
|
return ast;
|
||||||
}
|
}
|
||||||
#endif /* !RIPPER */
|
#endif /* !RIPPER */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue