[Mesa-dev] [PATCH v4 1/2] egl/wayland: Cleanup private display connection when init fails
Jonas Ådahl
jadahl at gmail.com
Fri Jan 13 15:05:09 UTC 2017
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>
Cc: mesa-stable at lists.freedesktop.org
---
Changes since v3:
* Also disconnect in the swrast initializer error path.
* Changed condition to be the same as when the connection is created
src/egl/drivers/dri2/platform_wayland.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 789e035..b479e0d 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1283,6 +1283,8 @@ dri2_initialize_wayland_drm(_EGLDriver *drv, _EGLDisplay *disp)
cleanup_registry:
wl_registry_destroy(dri2_dpy->wl_registry);
wl_event_queue_destroy(dri2_dpy->wl_queue);
+ if (disp->PlatformDisplay == NULL)
+ wl_display_disconnect(dri2_dpy->wl_dpy);
cleanup_dpy:
free(dri2_dpy);
disp->DriverData = NULL;
@@ -1924,6 +1926,8 @@ dri2_initialize_wayland_swrast(_EGLDriver *drv, _EGLDisplay *disp)
cleanup_registry:
wl_registry_destroy(dri2_dpy->wl_registry);
wl_event_queue_destroy(dri2_dpy->wl_queue);
+ if (disp->PlatformDisplay == NULL)
+ wl_display_disconnect(dri2_dpy->wl_dpy);
cleanup_dpy:
free(dri2_dpy);
disp->DriverData = NULL;
--
2.7.4
More information about the mesa-dev
mailing list