From d76947b6668e0fabe0a4551ac6c2c978f93768cd Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Mon, 3 Feb 2020 20:01:21 +0000 Subject: [PATCH] gl-renderer: Avoid double-free on init failure If gl-renderer fails its initialisation, we return to compositor teardown, which will try to free the renderer if ec->renderer was set. This is unfortunate when we've already torn it down whilst failing gl-renderer init, so just clear the renderer member so we don't try to tear down twice. Signed-off-by: Daniel Stone Reported-by: Emil Velikov --- libweston/renderer-gl/gl-renderer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index a40db360..79285c00 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -3596,6 +3596,7 @@ fail_terminate: eglTerminate(gr->egl_display); fail: free(gr); + ec->renderer = NULL; return -1; }