aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inertia.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/inertia.c b/inertia.c
index 4e84f56..dd80ebe 100644
--- a/inertia.c
+++ b/inertia.c
@@ -1626,6 +1626,10 @@ static game_state *execute_move(game_state *state, char *move)
sol->list[i] = move[i] - '0';
ret = dup_game(state);
ret->cheated = TRUE;
+ if (ret->soln && --ret->soln->refcount == 0) {
+ sfree(ret->soln->list);
+ sfree(ret->soln);
+ }
ret->soln = sol;
ret->solnpos = 0;
sol->refcount = 1;