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

remove memset when freeing

parent cb25c082
No related branches found
No related tags found
No related merge requests found
......@@ -106,13 +106,14 @@ void destroy_juveniles(const struct cats_grid *grid, const cats_dt_coord row, co
assert(row >= 0 && row < grid->dimension.rows);
assert(col >= 0 && col < grid->dimension.cols);
assert(grid->juveniles != NULL);
const int32_t max_age_of_maturity = get_vital_age(grid, VA_AGE_OF_MATURITY_MAX);
const int32_t stages = max_age_of_maturity + 1;
assert(stages >= 0);
if (grid->juveniles[row][col]) {
memset(grid->juveniles[row][col], 0, stages * sizeof(cats_dt_population));
if (grid->juveniles[row] && grid->juveniles[row][col]) {
free(grid->juveniles[row][col]);
grid->juveniles[row][col] = NULL;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment