From d8c36904b69050916ca4876c363620c26b418c64 Mon Sep 17 00:00:00 2001 From: icst Date: Fri, 21 Jun 2024 21:32:48 -0400 Subject: [PATCH] cleanup tokens correctly --- lapis.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lapis.c b/lapis.c index ed9ba26..77f6993 100644 --- a/lapis.c +++ b/lapis.c @@ -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 );