chiark / gitweb /
Cleanups and memory leak fixes from James H.
authorSimon Tatham <anakin@pobox.com>
Sat, 16 Jul 2005 20:06:37 +0000 (20:06 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 16 Jul 2005 20:06:37 +0000 (20:06 +0000)
[originally from svn r6099]

dominosa.c
misc.c

index d1613b109a6471c02738b0f0bc17d0501c79756b..7e938bb99d0d25973f1da7b4e04314d0ed68bdbe 100644 (file)
@@ -1093,6 +1093,7 @@ static game_state *dup_game(game_state *state)
 static void free_game(game_state *state)
 {
     sfree(state->grid);
+    sfree(state->edges);
     if (--state->numbers->refcount <= 0) {
         sfree(state->numbers->numbers);
         sfree(state->numbers);
@@ -1154,7 +1155,7 @@ static char *solve_game(game_state *state, game_state *currstate,
                    int p2 = (i & 1) ? p1+1 : p1+w;
 
                    extra = sprintf(buf, ";%c%d,%d",
-                                   v==-1 ? 'E' : 'D', p1, p2);
+                                   (int)(v==-1 ? 'E' : 'D'), p1, p2);
 
                    if (retlen + extra + 1 >= retsize) {
                        retsize = retlen + extra + 256;
@@ -1257,7 +1258,7 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
             (state->grid[d1] != d1 || state->grid[d2] != d2))
             return NULL;
 
-        sprintf(buf, "%c%d,%d", button == RIGHT_BUTTON ? 'E' : 'D', d1, d2);
+        sprintf(buf, "%c%d,%d", (int)(button == RIGHT_BUTTON ? 'E' : 'D'), d1, d2);
         return dupstr(buf);
     }
 
diff --git a/misc.c b/misc.c
index 17ec48c4cc0683735e00e08bfcd79922597794ee..4e9e8c855ade6d68403097e8c7cc361ab4b38a76 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -210,6 +210,7 @@ void shuffle(void *array, int nelts, int eltsize, random_state *rs)
             memcpy(carray + eltsize * j, tmp, eltsize);
         }
     }
+    sfree(tmp);
 }
 
 /* vim: set shiftwidth=4 tabstop=8: */