From 5719752a7677151ab382a98a6a95789eae2d547c Mon Sep 17 00:00:00 2001 From: s-prechtl Date: Wed, 11 Dec 2024 15:44:29 +0100 Subject: [PATCH] feat: add some free, this changes the sum but is still wrong --- 2024/Day5/src/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/2024/Day5/src/main.c b/2024/Day5/src/main.c index 78e3153..5d3716d 100644 --- a/2024/Day5/src/main.c +++ b/2024/Day5/src/main.c @@ -132,6 +132,7 @@ void read_updates_from_file(int ***updates, const char *filename) { if (!is_updates) { continue; } + char **tokens = str_split(buffer, ','); int *values = NULL; if (arrlen(tokens) > 0) { @@ -142,7 +143,9 @@ void read_updates_from_file(int ***updates, const char *filename) { arrput(*updates, values); } } + free(tokens); } + free(buffer); } void read_por_from_file(PageOrderingRules **pageOrderingRules, const char *filename) { @@ -169,8 +172,8 @@ void read_por_from_file(PageOrderingRules **pageOrderingRules, const char *filen arrput(current_values, value); hmput(*pageOrderingRules, key, current_values); } + free(tokens); } - free(buffer); }