chiark / gitweb /
James Harvey's memory leak patch for Flip.
authorSimon Tatham <anakin@pobox.com>
Sun, 19 Jun 2005 21:49:53 +0000 (21:49 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 19 Jun 2005 21:49:53 +0000 (21:49 +0000)
[originally from svn r5980]

flip.c

diff --git a/flip.c b/flip.c
index a5ee04479d4398ae3a47367dce6afd32de2f9766..df1106cf2e86b7f7381034c577ea86049c50d63f 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;
 }