mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Don't leak grids in Loopy's validate_desc()
This commit is contained in:
9
loopy.c
9
loopy.c
@ -791,13 +791,18 @@ static const char *validate_desc(const game_params *params, const char *desc)
|
|||||||
count += *desc - 'a' + 1;
|
count += *desc - 'a' + 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
grid_free(g);
|
||||||
return "Unknown character in description";
|
return "Unknown character in description";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count < g->num_faces)
|
if (count < g->num_faces) {
|
||||||
|
grid_free(g);
|
||||||
return "Description too short for board size";
|
return "Description too short for board size";
|
||||||
if (count > g->num_faces)
|
}
|
||||||
|
if (count > g->num_faces) {
|
||||||
|
grid_free(g);
|
||||||
return "Description too long for board size";
|
return "Description too long for board size";
|
||||||
|
}
|
||||||
|
|
||||||
grid_free(g);
|
grid_free(g);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user