From a3b6b2d3055070da9bf7054fecfd0b171c398eb7 Mon Sep 17 00:00:00 2001 From: Jonas Ådahl Date: Sun, 28 Oct 2012 00:50:12 +0200 Subject: wayland: Destroy frame callback when destroying surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a frame callback is not destroyed when destroying a surface, its handler function will be invoked if the surface was destroyed after the callback was requested but before it was invoked, causing a write on free:ed memory. This can happen if eglDestroySurface() is called shortly after eglSwapBuffers(). Note: This is a candidate for stable branches. Reviewed-by: Kristian Høgsberg --- src/egl/drivers/dri2/platform_wayland.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/egl') diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 9153ef92939..772116a1925 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -213,6 +213,9 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) dri2_surf->third_buffer); } + if (dri2_surf->frame_callback) + wl_callback_destroy(dri2_surf->frame_callback); + free(surf); return EGL_TRUE; -- cgit v1.2.3