From bb624754f10e5c03c544c8f606a4f9812c08bcb2 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 19 Jan 2022 02:24:39 +0000 Subject: [PATCH] gl-renderer: Don't leak EGLImages on import fail This only happens for the legacy renderer, but still, might as well clean up after ourselves when we can't import a secondary plane. Signed-off-by: Daniel Stone --- libweston/renderer-gl/gl-renderer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index 7ea176a8..903c9d3c 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -2315,7 +2315,9 @@ gl_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer) attribs); if (!gb->images[i]) { weston_log("failed to create img for plane %d\n", i); - continue; + while (--i >= 0) + egl_image_unref(gb->images[i]); + return; } glActiveTexture(GL_TEXTURE0 + i);