From 838df78fe94e5bbb653bb123b2cb0aac1db0bfb1 Mon Sep 17 00:00:00 2001 From: AndyZhou Date: Wed, 22 Dec 2021 18:54:49 +0800 Subject: [PATCH] agl-compositor: Add NULL check after creating surface/view Add a check to verify if both the surface/view was created successfully in function create_black_surface_view of src/shell.c file. Bug-AGL: SPEC-4193 Signed-off-by: ZhouMingying Change-Id: I69c6a6023c8b7a3b6e376f3cba25020a851648ab --- src/shell.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/shell.c b/src/shell.c index 048cbeb..f874fd0 100644 --- a/src/shell.c +++ b/src/shell.c @@ -876,9 +876,13 @@ create_black_surface_view(struct ivi_output *output) return; surface = weston_surface_create(wc); + if (!surface) + return; view = weston_view_create(surface); - - assert(view || surface); + if (!view) { + weston_surface_destroy(surface); + return; + } weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1); weston_surface_set_size(surface, woutput->width, woutput->height); -- 2.16.6