From eacf29f8342a4d759fa70b4d7217e86aa2fb4a15 Mon Sep 17 00:00:00 2001 From: sanine Date: Tue, 31 Jan 2023 14:24:55 -0600 Subject: fix all memory leaks --- yy/main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'yy/main.c') diff --git a/yy/main.c b/yy/main.c index 823db5a..5bc5508 100644 --- a/yy/main.c +++ b/yy/main.c @@ -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; } -- cgit v1.2.1