Fix tiny memory leak if you pressed Solve while part way through an

existing solution path.

[originally from svn r7571]
This commit is contained in:
Simon Tatham
2007-05-12 08:26:58 +00:00
parent 81e3a145bf
commit 5b8b855376

View File

@ -1626,6 +1626,10 @@ static game_state *execute_move(game_state *state, char *move)
sol->list[i] = move[i] - '0'; sol->list[i] = move[i] - '0';
ret = dup_game(state); ret = dup_game(state);
ret->cheated = TRUE; ret->cheated = TRUE;
if (ret->soln && --ret->soln->refcount == 0) {
sfree(ret->soln->list);
sfree(ret->soln);
}
ret->soln = sol; ret->soln = sol;
ret->solnpos = 0; ret->solnpos = 0;
sol->refcount = 1; sol->refcount = 1;