[Mesa-dev] [PATCH v3 2/2] egl/wayland: Cleanup private display connection when init fails

Emil Velikov emil.l.velikov at gmail.com
Fri Jan 13 14:09:11 UTC 2017


On 13 January 2017 at 09:05, Jonas Ådahl <jadahl at gmail.com> wrote:
> When failing to initializing the Wayland EGL driver, don't leak the
> display server connection if it was us who created it.
>
> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> ---
>
> Changes since v2 (where it was part of PATCH 1/2):
>
>  * Fixed use-after-free
>
>  src/egl/drivers/dri2/platform_wayland.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
> index 8e49838..cad357d 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -1287,6 +1287,8 @@ dri2_initialize_wayland_drm(_EGLDriver *drv, _EGLDisplay *disp)
>     wl_proxy_wrapper_destroy(dri2_dpy->wl_dpy_wrapper);
>   cleanup_dpy_wrapper:
>     wl_event_queue_destroy(dri2_dpy->wl_queue);
> +   if (dri2_dpy->wl_dpy != disp->PlatformDisplay)
Please use conditional as the one during setup. Namely:
disp->PlatformDisplay == NULL
dri2_initialize_wayland_swrast needs a similar hunk, as well as
platform_drm.c. Can you address those as with later patches ?

To make it cleaner to cherry-pick let's have this as 1/2. Do add the
following tag.
Cc: mesa-stable at lists.freedesktop.org

With the above, pre-emptively
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

Thanks
Emil


More information about the mesa-dev mailing list