egl/wayland: Set disp->DriverData to NULL on error
authorNicolas Boichat <drinkcat@chromium.org>
Thu, 4 Aug 2016 02:07:51 +0000 (10:07 +0800)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 15 Aug 2016 18:00:30 +0000 (19:00 +0100)
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" <mesa-stable@lists.freedesktop.org>
Reported-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/egl/drivers/dri2/platform_wayland.c

index e714e44124bc3765a5d9b9d3a49cd38b0ebd0581..cbdcd768a228099078ae808228c125dec9261467 100644 (file)
@@ -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;
 }