From 4bab5e531b4b49c9b41d2140dd570d05947e7c40 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 26 Apr 2011 13:44:27 +0000 Subject: Fix two memory leaks reported by Tiago Dionizio in recent Loopy development. [originally from svn r9163] --- grid.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'grid.c') diff --git a/grid.c b/grid.c index d73e521..d7e6442 100644 --- a/grid.c +++ b/grid.c @@ -454,6 +454,14 @@ static void grid_trim_vigorously(grid *g) 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. */ for (i = 0; i < g->num_dots; i++) -- cgit v1.1