summaryrefslogtreecommitdiff
path: root/desktop-shell
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2015-05-29 10:46:44 -0500
committerDaniel Stone <daniels@collabora.com>2015-08-06 16:04:15 +0100
commite42d7548436e98665a3f48cb3a11ef1937f52273 (patch)
treeb1d18ba15b9c11643fc8baa578cd90696a209ed3 /desktop-shell
parentf965db5fc1799c2ae6adfe92896eb315a0c3447c (diff)
downloadweston-e42d7548436e98665a3f48cb3a11ef1937f52273.tar.gz
desktop-shell: drop shell_client from the head of the surface list on destroy
This prevents a use after free when the surfaces are automatically cleaned up later, as shell_client's freed node was still in the surface list. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'desktop-shell')
-rw-r--r--desktop-shell/shell.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 487c3e73..05aa340d 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5841,6 +5841,13 @@ handle_shell_client_destroy(struct wl_listener *listener, void *data)
if (sc->ping_timer)
wl_event_source_remove(sc->ping_timer);
+
+ /* Since we're about to free shell_client, we remove it from the
+ * head of the surface list so we don't use that freed list node
+ * during surface clean up later on.
+ */
+ wl_list_remove(&sc->surface_list);
+
free(sc);
}