From c1e7151eb6c4cec1448f514be9d66b529c23e42a Mon Sep 17 00:00:00 2001 From: ganjing Date: Tue, 28 Jul 2020 15:28:45 +0800 Subject: [PATCH] desktop-shell: check memory allocation in switcher_binding after calling malloc() , be sure to determine whether the allocating for memory space is successful Signed-off-by: ganjing --- desktop-shell/shell.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index ef0696ed..40cba183 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -4630,6 +4630,9 @@ switcher_binding(struct weston_keyboard *keyboard, const struct timespec *time, struct switcher *switcher; switcher = malloc(sizeof *switcher); + if (!switcher) + return; + switcher->shell = shell; switcher->current = NULL; switcher->listener.notify = switcher_handle_view_destroy;