Module: Mesa
Branch: master
Commit: 361796651c5abb21ff429466c061119dce8f33d5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=361796651c5abb21ff429466c061119dce8f33d5

Author: Jonas Ådahl <jad...@gmail.com>
Date:   Fri Jan 13 23:05:09 2017 +0800

egl/wayland: Cleanup private display connection when init fails

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 <jad...@gmail.com>
Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.veli...@collabora.com>
Reviewed-by: Daniel Stone <dani...@collabora.com>

---

 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 fd4812a..2b50d8e 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;
@@ -1921,6 +1923,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;

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to