Permalink
Browse files

improvements suggested by the splint tool

  • Loading branch information...
1 parent 649fe59 commit 290fc665da332fd38711c99a79d2c54951a8465f @masak committed Jun 1, 2010
Showing with 6 additions and 3 deletions.
  1. +3 −0 druid.c
  2. +3 −3 test.c
View
@@ -46,5 +46,8 @@ int main() {
print_board(pieces, heights);
+ free(heights);
+ free(pieces);
+
return 0;
}
View
6 test.c
@@ -58,8 +58,8 @@ druid_game *new_druid_game(int size) {
new_game = malloc(sizeof (druid_game));
new_game->size = size;
new_game->player_on_turn = VERTICAL;
- new_game->colors = calloc(size * size, sizeof (int));
- new_game->heights = calloc(size * size, sizeof (int));
+ new_game->colors = calloc((size_t)size * size, sizeof (int));
+ new_game->heights = calloc((size_t)size * size, sizeof (int));
new_game->previous_move = ILLEGAL;
new_game->finished = 0;
return new_game;
@@ -174,7 +174,7 @@ int who_won(druid_game *game) {
if (game->previous_move == ILLEGAL)
return NONE;
- visited = calloc(size * size, sizeof (int));
+ visited = calloc((size_t)size * size, sizeof (int));
queue = malloc(sizeof (int) * size * size);
visited[previous_move] = 1;
queue[current] = previous_move;

0 comments on commit 290fc66

Please sign in to comment.