aboutsummaryrefslogtreecommitdiff
path: root/04/part2.c
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-12-21 19:07:23 +0800
committerMistivia <i@mistivia.com>2025-12-21 19:07:23 +0800
commitee1a1d291e822723202bd2e23612d6f65cfc20fc (patch)
tree4df3b391ac6e373c720e0d2be100db9f1673d9d2 /04/part2.c
parentf6a4f79dacab0218d5ffd4ec04244c8e6b36a8a5 (diff)
day 4 clean
Diffstat (limited to '04/part2.c')
-rw-r--r--04/part2.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/04/part2.c b/04/part2.c
index e715fdb..3217577 100644
--- a/04/part2.c
+++ b/04/part2.c
@@ -101,6 +101,13 @@ int iter(StringVector *map, int height, int width) {
return forked;
}
+void free_map(StringVector *map) {
+ for (int i = 0; i < StringVector_len(map); i++) {
+ free((void*)*StringVector_ref(map, i));
+ }
+ StringVector_free(map);
+}
+
int main() {
StringVector map = readmap();
int height = StringVector_len(&map);
@@ -115,5 +122,7 @@ int main() {
}
}
printf("%d\n", res);
+
+ free_map(&map);
return 0;
} \ No newline at end of file