shithub: puzzles

Download patch

ref: fd1735170e408b32847c481eea2cffc4f164c7df
parent: fe65b2efbd4696c98b9b5f9ef5a3bac2715b12b7
author: Simon Tatham <anakin@pobox.com>
date: Sun Sep 4 08:53:27 EDT 2005

Patch from Ton van Overbeek to fix a small memory leak in
midend_solve().

[originally from svn r6271]

--- a/midend.c
+++ b/midend.c
@@ -1169,8 +1169,11 @@
      * Now enter the solved state as the next move.
      */
     midend_stop_anim(me);
-    while (me->nstates > me->statepos)
+    while (me->nstates > me->statepos) {
 	me->ourgame->free_game(me->states[--me->nstates].state);
+        if (me->states[me->nstates].movestr)
+            sfree(me->states[me->nstates].movestr);
+    }
     ensure(me);
     me->states[me->nstates].state = s;
     me->states[me->nstates].movestr = movestr;