cleanup tokens correctly

This commit is contained in:
icst 2024-06-21 21:32:48 -04:00
parent 75a98858cd
commit d8c36904b6

View file

@ -677,7 +677,10 @@ lapis_node_t *lapis_parse_expr(int64_t *nnodes, FILE *f) {
*nnodes = num_nodes;
return nodes;
ERROR:
if ( tokens != NULL ) free( tokens );
if ( tokens != NULL ) {
for (size_t n=0; n < ntokens; n++) lapis_token_free(&tokens[n]);
free(tokens);
}
if ( oper_priorities != NULL ) free( oper_priorities );
if ( oper_arg_form != NULL ) free( oper_arg_form );
if ( nodes != NULL ) free( nodes );