On Thursday, 2018-02-22 13:37:54 +0000, Frank Binns wrote:
> 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 <francisbi...@gmail.com>

Error paths are basically never tested...
You're entirely right, thanks for catching this!

Reviewed-by: Eric Engestrom <eric.engest...@imgtec.com>

> ---
>  src/egl/drivers/dri2/egl_dri2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index 17b646e..c06a0ca 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -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);
>     }
> -- 
> 2.7.4
> 
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to