From: Nicolas Boichat Date: Thu, 4 Aug 2016 02:07:51 +0000 (+0800) Subject: egl/wayland: Set disp->DriverData to NULL on error X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=48fd952f28a5fcd71eed5a60c8e3a10231c7a5b0;p=mesa.git egl/wayland: Set disp->DriverData to NULL on error Avoid use-after-free, fix spec@egl_khr_fence_sync@conformance. Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display) Cc: "12.0" Reported-by: Michel Dänzer Signed-off-by: Nicolas Boichat Tested-by: Martin Peres Reviewed-by: Emil Velikov --- diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index e714e44124b..cbdcd768a22 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -1236,6 +1236,7 @@ dri2_initialize_wayland_drm(_EGLDriver *drv, _EGLDisplay *disp) wl_event_queue_destroy(dri2_dpy->wl_queue); cleanup_dpy: free(dri2_dpy); + disp->DriverData = NULL; return EGL_FALSE; } @@ -1881,6 +1882,7 @@ dri2_initialize_wayland_swrast(_EGLDriver *drv, _EGLDisplay *disp) wl_event_queue_destroy(dri2_dpy->wl_queue); cleanup_dpy: free(dri2_dpy); + disp->DriverData = NULL; return EGL_FALSE; }