From 800ed958c33092d694686fcc25c0283dfba86459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 25 Dec 2012 13:01:08 +0100 Subject: wayland: Don't cancel a roundtrip when any event is received MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since wl_display_dispatch_queue() returns the number of processed events or -1 on error, only cancel the roundtrip if an -1 is returned. This also fixes a potential memory corruption bug happening when the roundtrip does an early return and the callback later writes to the then out of scope stack allocated `done' parameter. Reviewed-by: Kristian Høgsberg --- src/egl/drivers/dri2/platform_wayland.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/egl/drivers') diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index ba54286b7bc..10a0f0830d8 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -70,6 +70,9 @@ roundtrip(struct dri2_egl_display *dri2_dpy) while (ret != -1 && !done) ret = wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue); + if (!done) + wl_callback_destroy(callback); + return ret; } -- cgit v1.2.1