diff options
author | c | 2023-11-28 21:32:47 -0500 |
---|---|---|
committer | c | 2023-11-28 21:32:47 -0500 |
commit | 9f051cf7a3483935c9a740c5339c19fedbdc80e4 (patch) | |
tree | ba2e7b84e53fd1fecc8136b5b023efceb2c2a914 | |
parent | ea2b3178ec3a4b0739d8dc4946b2f504fd240113 (diff) |
Fixed memory leak -- was planting trees before it was quite sure it needed to.
-rw-r--r-- | src/parser.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parser.c b/src/parser.c index 1ed43b8..06c72d4 100644 --- a/src/parser.c +++ b/src/parser.c @@ -117,15 +117,15 @@ tree_t* parser_parse_block(parser_t* parser) { } tree_t* parser_parse_tag(parser_t* parser) { + if (parser->token->type != TOKEN_TAG) { return NULL; } + tree_t* tag; tag = tree_init(TREE_TYPE_TAG); - if (parser->token->type != TOKEN_TAG) { return NULL; } - tag->data.tag.val = parser->token->val; parser->token->val = NULL; - parser_nxt_token(parser) && (tag->data.tag.nxt = parser_parse_tag(parser)); + tag->data.tag.nxt = (parser_nxt_token(parser) ? parser_parse_tag(parser) : NULL); return tag; } |