Fix tiny memory leak if you pressed Solve while part way through an
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sat, 12 May 2007 08:26:58 +0000 (08:26 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sat, 12 May 2007 08:26:58 +0000 (08:26 +0000)
existing solution path.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@7571 cda61777-01e9-0310-a592-d414129be87e

inertia.c

index 4e84f56..dd80ebe 100644 (file)
--- 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;