diff options
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/parser.c | 2 | ||||
-rw-r--r-- | src/tree.c | 3 |
3 files changed, 4 insertions, 3 deletions
@@ -53,8 +53,8 @@ int main(int argc, char* argv[]) { /* Clean up parser stuff. */ token_destroy(lexer->tokenl); - tree_destroy(parser->tree); lexer_destroy(lexer); + tree_destroy(parser->tree); parser_destroy(parser); free(src); diff --git a/src/parser.c b/src/parser.c index c378d75..af6887e 100644 --- a/src/parser.c +++ b/src/parser.c @@ -56,7 +56,7 @@ tree_t* parser_parse_lstr(parser_t* parser) { lstr->data.lstr.len = strlen(parser->token->val); /* Swap pointers to allow for future token destruction. */ lstr->data.lstr.val = parser->token->val; - parser->token->val = NULL; + parser->token->val = NULL; return lstr; } @@ -19,6 +19,7 @@ tree_t* tree_init(int type) { tree->data.lint.val = 0; break; case TREE_TYPE_LSTR: + tree->data.lstr.val = NULL; tree->data.lstr.len = 0; break; case TREE_TYPE_TAG: @@ -72,7 +73,7 @@ void tree_destroy(tree_t* tree) { tree_destroy(tree->data.darg.nxt); break; case TREE_TYPE_CARG: - free(tree->data.carg.val); + tree_destroy(tree->data.carg.val); tree_destroy(tree->data.carg.nxt); break; case TREE_TYPE_DEF: |