chiark / gitweb /
James H's memory leak fixes to Inertia.
authorSimon Tatham <anakin@pobox.com>
Thu, 1 Sep 2005 11:59:51 +0000 (11:59 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 1 Sep 2005 11:59:51 +0000 (11:59 +0000)
[originally from svn r6255]

inertia.c

index fc213da2deeeda860759002f885f72ee6f136136..95bdcc8890c8bf2f6bf94f699a551bf78671c0ea 100644 (file)
--- a/inertia.c
+++ b/inertia.c
@@ -221,6 +221,9 @@ static struct solver_scratch *new_scratch(int w, int h)
 
 static void free_scratch(struct solver_scratch *sc)
 {
+    sfree(sc->reachable_from);
+    sfree(sc->reachable_to);
+    sfree(sc->positions);
     sfree(sc);
 }
 
@@ -940,6 +943,8 @@ static game_drawstate *game_new_drawstate(drawing *dr, game_state *state)
 
 static void game_free_drawstate(drawing *dr, game_drawstate *ds)
 {
+    if (ds->player_background)
+       blitter_free(dr, ds->player_background);
     sfree(ds->grid);
     sfree(ds);
 }