egl/dri2: fix segfault when display initialisation fails
authorFrank Binns <francisbinns@gmail.com>
Thu, 22 Feb 2018 13:37:54 +0000 (13:37 +0000)
committerEric Engestrom <eric.engestrom@imgtec.com>
Fri, 23 Feb 2018 11:13:22 +0000 (11:13 +0000)
dri2_display_destroy() is called when platform specific display
initialisation fails. However, this would typically lead to a
segfault due to the dri2_egl_display vbtl not having been set up.

Fixes: 2db95482964 ("loader_dri3/glx/egl: Optionally use a blit
context for blitting operations")
Signed-off-by: Frank Binns <francisbinns@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/egl/drivers/dri2/egl_dri2.c

index 17b646e7ede6c907074a4fad232f4f90cf52202a..c06a0ca099572aa332e524e7957974561ca19a49 100644 (file)
@@ -973,7 +973,7 @@ dri2_display_destroy(_EGLDisplay *disp)
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
 
    if (dri2_dpy->own_dri_screen) {
-      if (dri2_dpy->vtbl->close_screen_notify)
+      if (dri2_dpy->vtbl && dri2_dpy->vtbl->close_screen_notify)
          dri2_dpy->vtbl->close_screen_notify(disp);
       dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
    }