From 98ffc93b95c2b43d03735cfccf52fac203c26ac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 24 Sep 2010 10:01:18 -0400 Subject: [PATCH] Fix EGLImageKHR leak in wl_buffer destroy --- compositor/compositor.h | 1 + compositor/drm.c | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/compositor/compositor.h b/compositor/compositor.h index 3122c0a3..d1759654 100644 --- a/compositor/compositor.h +++ b/compositor/compositor.h @@ -121,6 +121,7 @@ struct wlsc_drm { struct wlsc_buffer { struct wl_buffer base; + struct wlsc_compositor *compositor; int32_t width, height; EGLImageKHR image; struct wl_visual *visual; diff --git a/compositor/drm.c b/compositor/drm.c index 1d7bf9b4..87863e80 100644 --- a/compositor/drm.c +++ b/compositor/drm.c @@ -43,12 +43,9 @@ destroy_buffer(struct wl_resource *resource, struct wl_client *client) { struct wlsc_buffer *buffer = container_of(resource, struct wlsc_buffer, base.base); + struct wlsc_compositor *compositor = buffer->compositor; -#if 0 - /* FIXME: Need backlink to EGL display here */ - eglDestroyImageKHR(ec->display, buffer->image); -#endif - + eglDestroyImageKHR(compositor->display, buffer->image); free(buffer); } @@ -101,6 +98,7 @@ drm_create_buffer(struct wl_client *client, struct wl_drm *drm_base, attribs[3] = height; attribs[5] = stride / 4; + buffer->compositor = compositor; buffer->width = width; buffer->height = height; buffer->visual = visual;