From: Simon Tatham Date: Sat, 12 May 2007 08:26:58 +0000 (+0000) Subject: Fix tiny memory leak if you pressed Solve while part way through an X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;ds=sidebyside;h=5b8b85537621204a12962c4b3afb708a24817a54;p=sgt-puzzles.git Fix tiny memory leak if you pressed Solve while part way through an existing solution path. [originally from svn r7571] --- 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;