window: destroy surfaces on display_destroy()

Destroy the window decoration surfaces and pointer surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
diff --git a/clients/window.c b/clients/window.c
index bead68f..e5d34a9 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -697,6 +697,19 @@
 
 }
 
+static void
+destroy_pointer_surfaces(struct display *display)
+{
+	int i, count;
+
+	count = ARRAY_LENGTH(pointer_images);
+	for (i = 0; i < count; ++i) {
+		if (display->pointer_surfaces[i])
+			cairo_surface_destroy(display->pointer_surfaces[i]);
+	}
+	free(display->pointer_surfaces);
+}
+
 cairo_surface_t *
 display_get_pointer_surface(struct display *display, int pointer,
 			    int *width, int *height,
@@ -2663,6 +2676,12 @@
 	display_destroy_inputs(display);
 
 	fini_xkb(display);
+
+	cairo_surface_destroy(display->active_frame);
+	cairo_surface_destroy(display->inactive_frame);
+	cairo_surface_destroy(display->shadow);
+	destroy_pointer_surfaces(display);
+
 	fini_egl(display);
 
 	if (display->shell)