mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Fix two memory leaks reported by Tiago Dionizio in recent Loopy
development. [originally from svn r9163]
This commit is contained in:
8
grid.c
8
grid.c
@ -453,6 +453,14 @@ static void grid_trim_vigorously(grid *g)
|
|||||||
for (i = newdots = 0; i < g->num_dots; i++)
|
for (i = newdots = 0; i < g->num_dots; i++)
|
||||||
dots[i] = (dots[i] ? newdots++ : -1);
|
dots[i] = (dots[i] ? newdots++ : -1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free the dynamically allocated 'dots' pointer lists in faces
|
||||||
|
* we're going to discard.
|
||||||
|
*/
|
||||||
|
for (i = 0; i < g->num_faces; i++)
|
||||||
|
if (faces[i] < 0)
|
||||||
|
sfree(g->faces[i].dots);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Go through and compact the arrays.
|
* Go through and compact the arrays.
|
||||||
*/
|
*/
|
||||||
|
2
loopy.c
2
loopy.c
@ -917,6 +917,8 @@ static game_drawstate *game_new_drawstate(drawing *dr, game_state *state)
|
|||||||
|
|
||||||
static void game_free_drawstate(drawing *dr, game_drawstate *ds)
|
static void game_free_drawstate(drawing *dr, game_drawstate *ds)
|
||||||
{
|
{
|
||||||
|
sfree(ds->textx);
|
||||||
|
sfree(ds->texty);
|
||||||
sfree(ds->clue_error);
|
sfree(ds->clue_error);
|
||||||
sfree(ds->clue_satisfied);
|
sfree(ds->clue_satisfied);
|
||||||
sfree(ds->lines);
|
sfree(ds->lines);
|
||||||
|
Reference in New Issue
Block a user