aboutsummaryrefslogtreecommitdiff
path: root/grid.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2011-04-26 13:44:27 +0000
committerSimon Tatham <anakin@pobox.com>2011-04-26 13:44:27 +0000
commit4bab5e531b4b49c9b41d2140dd570d05947e7c40 (patch)
tree74390bd027e0e9355203eb03da978664c280b8f8 /grid.c
parent8266b71475d2366a530b34d46a43dce3eceed2ff (diff)
downloadpuzzles-4bab5e531b4b49c9b41d2140dd570d05947e7c40.zip
puzzles-4bab5e531b4b49c9b41d2140dd570d05947e7c40.tar.gz
puzzles-4bab5e531b4b49c9b41d2140dd570d05947e7c40.tar.bz2
puzzles-4bab5e531b4b49c9b41d2140dd570d05947e7c40.tar.xz
Fix two memory leaks reported by Tiago Dionizio in recent Loopy
development. [originally from svn r9163]
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c8
1 files changed, 8 insertions, 0 deletions
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++)