shithub: puzzles

Download patch

ref: 5b8b85537621204a12962c4b3afb708a24817a54
parent: 81e3a145bff031c0bb010a3678870990ae915faf
author: Simon Tatham <anakin@pobox.com>
date: Sat May 12 04:26:58 EDT 2007

Fix tiny memory leak if you pressed Solve while part way through an
existing solution path.

[originally from svn r7571]

--- a/inertia.c
+++ b/inertia.c
@@ -1626,6 +1626,10 @@
 	    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;