egl/dri2: bail out on NULL dpy in dri2_display_release()
authorEmil Velikov <emil.velikov@collabora.com>
Thu, 18 Aug 2016 15:43:36 +0000 (16:43 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 14 Oct 2016 11:16:06 +0000 (12:16 +0100)
Currently all callers are careful enough not to do that, yet that will
not be the case in the future.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
src/egl/drivers/dri2/egl_dri2.c

index dacdfbd74f58d7199993b7f88a382222bd43ca2f..f2ed3c7d3a2eeb1a1d9da5fccd6dc1a0f255f3ac 100644 (file)
@@ -851,9 +851,14 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
 static void
 dri2_display_release(_EGLDisplay *disp)
 {
-   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+   struct dri2_egl_display *dri2_dpy;
    unsigned i;
 
+   if (!disp)
+      return;
+
+   dri2_dpy = dri2_egl_display(disp);
+
    assert(dri2_dpy->ref_count > 0);
    dri2_dpy->ref_count--;