akgl_path_relative took its ENOENT branch by returning from inside the HANDLE block, which skips the RELEASE_ERROR that FINISH ends with. The handled context was never given back, so one entry of AKERR_ARRAY_ERROR was lost per call and the 129th call hit "Unable to pull an error context from the array!" and exited the process. That branch is not an edge case: every asset path inside a tilemap is resolved relative to the map's own directory, so it is taken several times per map load. A game that loaded fifty levels died in the loader. It was found by a benchmark that loaded the fixture map in a loop, which is the first thing in this tree to call it more than a hundred times. The fallback now runs after FINISH, so the context is released on the way past. tests/util.c resolves AKERR_MAX_ARRAY_ERROR * 2 paths through the branch and asserts the pool is where it started -- against the old code that test does not fail, it terminates the suite. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
12 KiB
12 KiB