Skip to content

Commit

Permalink
[ruby/yarp] Do not leak memory from lex modes
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton authored and k0kubun committed Jun 22, 2023
1 parent edd4881 commit b879528
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions yarp/yarp.c
Expand Up @@ -12841,6 +12841,10 @@ yp_parser_free(yp_parser_t *parser) {
yp_comment_list_free(&parser->comment_list);
yp_constant_pool_free(&parser->constant_pool);
yp_newline_list_free(&parser->newline_list);

while (parser->lex_modes.index >= YP_LEX_STACK_SIZE) {
lex_mode_pop(parser);
}
}

// Parse the Ruby source associated with the given parser and return the tree.
Expand Down

0 comments on commit b879528

Please sign in to comment.