From: ganjing Date: Tue, 28 Jul 2020 07:28:45 +0000 (+0800) Subject: desktop-shell: check memory allocation in switcher_binding X-Git-Tag: upstream/9.0.0~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c1e7151eb6c4cec1448f514be9d66b529c23e42a;p=platform%2Fupstream%2Fweston.git 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 --- 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;