diff options
author | U. Artie Eoff <ullysses.a.eoff@intel.com> | 2014-05-21 09:20:02 -0700 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2014-05-23 11:29:48 +0300 |
commit | a35d028d66cdd83a4a08663231dd2504f1b228f9 (patch) | |
tree | 5d9ab3cc966b272b4194ec40f377a16d0ab309e5 | |
parent | 880193622024d7dc2b36421251d97b08da324570 (diff) | |
download | weston-a35d028d66cdd83a4a08663231dd2504f1b228f9.tar.gz weston-a35d028d66cdd83a4a08663231dd2504f1b228f9.tar.bz2 weston-a35d028d66cdd83a4a08663231dd2504f1b228f9.zip |
comp-wayland: use safe foreach when destroying outputs
wl_list_for_each dereference's output to increment the
next iteration of the loop. However, output is free'd
inside the loop resulting in a dereference to free'd
memory.
Use wl_list_for_each_safe instead, which is designed to
handle this kind of pattern.
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r-- | src/compositor-wayland.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index a08b71ab..76e5396f 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -1997,9 +1997,9 @@ err_free: static void wayland_compositor_destroy(struct wayland_compositor *c) { - struct weston_output *output; + struct weston_output *output, *next; - wl_list_for_each(output, &c->base.output_list, link) + wl_list_for_each_safe(output, next, &c->base.output_list, link) wayland_output_destroy(output); c->base.renderer->destroy(&c->base); |