James Harvey's memory leak patch for Flip.
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 19 Jun 2005 21:49:53 +0000 (21:49 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 19 Jun 2005 21:49:53 +0000 (21:49 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5980 cda61777-01e9-0310-a592-d414129be87e

flip.c

diff --git a/flip.c b/flip.c
index a5ee044..df1106c 100644 (file)
--- a/flip.c
+++ b/flip.c
@@ -590,6 +590,8 @@ static char *new_game_desc(game_params *params, random_state *rs,
     sprintf(ret, "%s,%s", mbmp, gbmp);
     sfree(mbmp);
     sfree(gbmp);
+    sfree(matrix);
+    sfree(grid);
     return ret;
 }
 
@@ -731,6 +733,7 @@ static game_state *solve_game(game_state *state, game_state *currstate,
                if (equations[j * (wh+1) + wh]) {
                    *error = "No solution exists for this position";
                    sfree(equations);
+                   sfree(und);
                    return NULL;
                }
            break;
@@ -852,6 +855,7 @@ static game_state *solve_game(game_state *state, game_state *currstate,
     sfree(shortest);
     sfree(solution);
     sfree(equations);
+    sfree(und);
 
     return ret;
 }