diff options
author | sanine <sanine.not@pm.me> | 2023-01-31 14:24:55 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-01-31 14:24:55 -0600 |
commit | eacf29f8342a4d759fa70b4d7217e86aa2fb4a15 (patch) | |
tree | ef6450d15f0a67117d751fd50ba901375c128eff /yy/main.c | |
parent | 8e21b8f52a5c566767df9b3fe105706b6888a89b (diff) |
fix all memory leaks
Diffstat (limited to 'yy/main.c')
-rw-r--r-- | yy/main.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -56,16 +56,23 @@ int main(int argc, char **argv) return -1; } - struct kalmia_t result; + struct kai_tag_t *document; yyscan_t scanner; kalmialex_init(&scanner); kalmiaset_in(in, scanner); - kalmiaparse(scanner, &result); + int result = kalmiaparse(scanner, &document); kalmialex_destroy(scanner); + fclose(in); - print_tag("", result.tag); - print_level(1, result.tag->children); + if (result != 0) { + return result; + } + + print_tag("", document); + print_level(1, document->children); + + kai_tag_destroy(document); return 0; } |