[PATCH] wayland: Don't leak wl_drm global when unbinding display

Ander Conselvan de Oliveira conselvan2 at gmail.com
Wed Oct 16 14:04:03 CEST 2013


From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>

---
 src/egl/wayland/wayland-drm/wayland-drm.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index 06bd18c..2f5acb2 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -41,6 +41,7 @@
 
 struct wl_drm {
 	struct wl_display *display;
+	struct wl_global *wl_drm_global;
 
 	void *user_data;
 	char *device_name;
@@ -275,7 +276,9 @@ wayland_drm_init(struct wl_display *display, char *device_name,
 
         drm->buffer_interface.destroy = buffer_destroy;
 
-	wl_global_create(display, &wl_drm_interface, 2, drm, bind_drm);
+	drm->wl_drm_global =
+		wl_global_create(display, &wl_drm_interface, 2,
+				 drm, bind_drm);
 
 	return drm;
 }
@@ -285,7 +288,7 @@ wayland_drm_uninit(struct wl_drm *drm)
 {
 	free(drm->device_name);
 
-	/* FIXME: need wl_display_del_{object,global} */
+	wl_global_destroy(drm->wl_drm_global);
 
 	free(drm);
 }
-- 
1.7.9.5



More information about the wayland-devel mailing list