Dispose AST before exit by yydebug

This commit is contained in:
Nobuyoshi Nakada 2024-02-15 22:58:58 +09:00
parent 1c41dc40d8
commit 7ac8d3d6ee

5
ruby.c
View File

@ -2304,7 +2304,10 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
ruby_set_script_name(opt->script_name); ruby_set_script_name(opt->script_name);
if (dump & DUMP_BIT(yydebug)) { if (dump & DUMP_BIT(yydebug)) {
dump &= ~DUMP_BIT(yydebug); dump &= ~DUMP_BIT(yydebug);
if (!dump) return Qtrue; if (!dump) {
rb_ast_dispose(ast);
return Qtrue;
}
} }
if (opt->ext.enc.index >= 0) { if (opt->ext.enc.index >= 0) {