diff --git a/examples/aoc2024/day08/part1.jou b/examples/aoc2024/day08/part1.jou index dadf638f..7656c926 100644 --- a/examples/aoc2024/day08/part1.jou +++ b/examples/aoc2024/day08/part1.jou @@ -40,10 +40,11 @@ def main() -> int: *p = '.' freqs: byte[100] + memset(&freqs, 0, sizeof(freqs)) nfreqs = 0 for p = antennas.data; *p != '\0'; p++: if *p != '.' and *p != '\n' and strchr(freqs, *p) == NULL: - assert nfreqs < sizeof(freqs)/sizeof(freqs[0]) + assert nfreqs + 1 < sizeof(freqs)/sizeof(freqs[0]) freqs[nfreqs++] = *p for i = 0; i < nfreqs; i++: diff --git a/examples/aoc2024/day08/part2.jou b/examples/aoc2024/day08/part2.jou index b4fb0894..d39d875b 100644 --- a/examples/aoc2024/day08/part2.jou +++ b/examples/aoc2024/day08/part2.jou @@ -64,10 +64,11 @@ def main() -> int: *p = '.' freqs: byte[100] + memset(&freqs, 0, sizeof(freqs)) nfreqs = 0 for p = antennas.data; *p != '\0'; p++: if *p != '.' and *p != '\n' and strchr(freqs, *p) == NULL: - assert nfreqs < sizeof(freqs)/sizeof(freqs[0]) + assert nfreqs + 1 < sizeof(freqs)/sizeof(freqs[0]) freqs[nfreqs++] = *p for i = 0; i < nfreqs; i++: diff --git a/examples/aoc2024/day11/part1.jou b/examples/aoc2024/day11/part1.jou index 639b50a2..414a4e9a 100644 --- a/examples/aoc2024/day11/part1.jou +++ b/examples/aoc2024/day11/part1.jou @@ -70,4 +70,5 @@ def main() -> int: nstones = blink(stones, nstones) printf("%d\n", nstones) # Output: 55312 + free(stones) return 0 diff --git a/examples/aoc2024/day12/part1.jou b/examples/aoc2024/day12/part1.jou index b8e58048..39fc5796 100644 --- a/examples/aoc2024/day12/part1.jou +++ b/examples/aoc2024/day12/part1.jou @@ -89,4 +89,6 @@ def main() -> int: result += (fence1 + fence2) * area printf("%d\n", result) # Output: 1930 + + free(grid.data) return 0 diff --git a/examples/aoc2024/day12/part2.jou b/examples/aoc2024/day12/part2.jou index 2c35b012..9932bc28 100644 --- a/examples/aoc2024/day12/part2.jou +++ b/examples/aoc2024/day12/part2.jou @@ -102,4 +102,6 @@ def main() -> int: result += (fence1 + fence2) * area printf("%d\n", result) # Output: 368 + + free(grid.data) return 0