[Mesa-dev] [PATCH 05/30] egl/dri2: bail out on NULL dpy in dri2_display_release()

Emil Velikov emil.l.velikov at gmail.com
Thu Aug 25 16:18:27 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

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 at collabora.com>
---
 src/egl/drivers/dri2/egl_dri2.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 7c1a5b9..b4656a8 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -842,9 +842,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--;
 
-- 
2.9.0



More information about the mesa-dev mailing list