From 5b8b85537621204a12962c4b3afb708a24817a54 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 12 May 2007 08:26:58 +0000 Subject: [PATCH] Fix tiny memory leak if you pressed Solve while part way through an existing solution path. [originally from svn r7571] --- inertia.c | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.30.2