From: Emil Velikov Date: Thu, 18 Aug 2016 15:43:36 +0000 (+0100) Subject: egl/dri2: bail out on NULL dpy in dri2_display_release() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d6dcf3b4ca7053e9c49780a398c3baabd884ff2c;p=mesa.git egl/dri2: bail out on NULL dpy in dri2_display_release() 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 Reviewed-by: Eric Engestrom --- diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index dacdfbd74f5..f2ed3c7d3a2 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -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--;