Skip to content
Snippets Groups Projects
Commit e2d66d64 authored by Andreas Gattringer's avatar Andreas Gattringer
Browse files

fully free seed bank at cleanup

parent 903b82a9
No related branches found
No related tags found
No related merge requests found
...@@ -255,6 +255,7 @@ void cleanup_grid_seeds_and_juveniles(struct cats_grid *grid) ...@@ -255,6 +255,7 @@ void cleanup_grid_seeds_and_juveniles(struct cats_grid *grid)
for (cats_dt_coord col = 0; col < grid->dimension.cols; col++) { for (cats_dt_coord col = 0; col < grid->dimension.cols; col++) {
destroy_seed_structure(grid, row, col); destroy_seed_structure(grid, row, col);
} }
free(grid->seed_bank[row]);
} }
} }
...@@ -265,14 +266,22 @@ void cleanup_grid_seeds_and_juveniles(struct cats_grid *grid) ...@@ -265,14 +266,22 @@ void cleanup_grid_seeds_and_juveniles(struct cats_grid *grid)
destroy_juveniles(grid, row, col); destroy_juveniles(grid, row, col);
} }
free(grid->seed_bank[row]); free(grid->juveniles[row]);
}
}
if (grid->seeds_produced) {
for (cats_dt_coord row = 0; row < grid->dimension.rows; row++) {
free(grid->seeds_produced[row]);
} }
} }
free(grid->seed_bank); free(grid->seed_bank);
free(grid->juveniles); free(grid->juveniles);
free(grid->seeds_produced);
grid->juveniles = NULL; grid->juveniles = NULL;
grid->seed_bank = NULL; grid->seed_bank = NULL;
grid->seeds_produced = NULL;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment