summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-10-19 10:26:27 +0300
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-10-24 12:50:17 +0300
commitf13227945515f3d2f654573bda861505e86e6ffa (patch)
treeb3f4253bc81a647f0a1e43d0afc9215bf3b2bb6b
parent4dab58343bd6eebda5da77b165be93926d147b67 (diff)
compositor-wayland: actually free parent_output
I could not find anywhere where struct parent_output was freed, so apparently we were leaking it. Check against wayland_backend_register_output() and add the missing clean-up: removal from the parent output list, and free(). registry_handle_global_remove() also needs fixing to use a safer loop, because now we are actually removing the list item. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Acked-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--libweston/compositor-wayland.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
index c0f67e9a..9486deae 100644
--- a/libweston/compositor-wayland.c
+++ b/libweston/compositor-wayland.c
@@ -2333,6 +2333,9 @@ wayland_parent_output_destroy(struct wayland_parent_output *output)
wl_list_remove(&mode->link);
free(mode);
}
+
+ wl_list_remove(&output->link);
+ free(output);
}
static void
@@ -2385,9 +2388,9 @@ registry_handle_global_remove(void *data, struct wl_registry *registry,
uint32_t name)
{
struct wayland_backend *b = data;
- struct wayland_parent_output *output;
+ struct wayland_parent_output *output, *next;
- wl_list_for_each(output, &b->parent.output_list, link)
+ wl_list_for_each_safe(output, next, &b->parent.output_list, link)
if (output->id == name)
wayland_parent_output_destroy(output);
}