[Mesa-dev] [PATCH] egl_dri2: check if driver_name is NULL before releasing it

Tapani Pälli tapani.palli at intel.com
Tue Oct 30 07:17:37 UTC 2018


On 10/30/18 8:26 AM, Zhaowei Yuan wrote:
> Pointer dri2_dpy->driver_name is probably NULL when calling
> dri2_display_destory, check this before releasing it.

It's fine for it to be NULL though and it looks like all the drivers set 
it correctly, there is no need for such check. Does this change fix 
something for you, what was the motivation for this change?

(same applies for the device_name patch)

> Signed-off-by: Zhaowei Yuan <zhaowei.yuan at samsung.com>
> ---
>   src/egl/drivers/dri2/egl_dri2.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index c5fa935..54cc334 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -967,7 +967,8 @@ dri2_display_destroy(_EGLDisplay *disp)
>         close(dri2_dpy->fd);
>      if (dri2_dpy->driver)
>         dlclose(dri2_dpy->driver);
> -   free(dri2_dpy->driver_name);
> +   if (dri2_dpy->driver_name)
> +      free(dri2_dpy->driver_name);
>   
>   #ifdef HAVE_WAYLAND_PLATFORM
>      free(dri2_dpy->device_name);
> 


More information about the mesa-dev mailing list