# HG changeset patch # User Mike Becker # Date 1781271153 -7200 # Node ID 43d1b3c33369bc511d4c26f957dccaaa2177c167 # Parent 1a84ee6b4bf0537b7caaf5816e9f55673bc6259f fix memory leak when simulating real threats diff -r 1a84ee6b4bf0 -r 43d1b3c33369 src/chess/rules.c --- a/src/chess/rules.c Fri Jun 12 15:28:00 2026 +0200 +++ b/src/chess/rules.c Fri Jun 12 15:32:33 2026 +0200 @@ -628,6 +628,7 @@ } for (uint8_t i = 0 ; i < candidatecount ; i++) { + // TODO: check if we really need full-blown simulations here GameState simulation = gamestate_copy_sim(gamestate); Move simmove = candidates[i]; apply_move(&simulation, &simmove); @@ -638,6 +639,7 @@ threats[(*threatcount)++] = candidates[i]; } } + gamestate_cleanup(&simulation); } return result;