summaryrefslogtreecommitdiffstats
path: root/meta-agl-core/recipes-graphics/wayland/weston/0001-gl-renderer-Avoid-double-free-on-init-failure.patch
blob: 582a33161c9f959b5003fb887a99af3b694663f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From d76947b6668e0fabe0a4551ac6c2c978f93768cd Mon Sep 17 00:00:00 2001
From: Daniel Stone <daniels@collabora.com>
Upstream-Status: Backport
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 <daniels@collabora.com>
Reported-by: Emil Velikov <emil.velikov@collabora.com>
---
 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 a40db3607..79285c008 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;
 }
 
-- 
2.33.0