From 7aebc787c5529997e422a054398ed739ca4cddfe Mon Sep 17 00:00:00 2001 From: Carlos Maniero Date: Tue, 2 May 2023 23:45:57 -0300 Subject: parser: Fixes block parser memory leak When a error occurs during a block parser the vector that stores the nodes had been destroyed but it's nodes don't. This commit fixes this by replacing the %vector_destroy% with %ast_node_destroy_vector%. Signed-off-by: Carlos Maniero --- src/parser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/parser.c') diff --git a/src/parser.c b/src/parser.c index f51f550..82d25f5 100644 --- a/src/parser.c +++ b/src/parser.c @@ -431,7 +431,7 @@ parser_parse_block_declarations(parser_t *parser) if (return_node == NULL) { scope_leave(parser->scope); - vector_destroy(body); + ast_node_destroy_vector(body); return NULL; } @@ -444,7 +444,7 @@ parser_parse_block_declarations(parser_t *parser) if (variable_node == NULL) { scope_leave(parser->scope); - vector_destroy(body); + ast_node_destroy_vector(body); return NULL; } @@ -457,7 +457,7 @@ parser_parse_block_declarations(parser_t *parser) if (variable_assignment == NULL) { scope_leave(parser->scope); - vector_destroy(body); + ast_node_destroy_vector(body); return NULL; } @@ -468,7 +468,7 @@ parser_parse_block_declarations(parser_t *parser) parser_error_report_unexpected_token(parser); scope_leave(parser->scope); - vector_destroy(body); + ast_node_destroy_vector(body); return NULL; } -- cgit v1.2.3