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 <ganjing@uniontech.com>
This commit is contained in:
@@ -4630,6 +4630,9 @@ switcher_binding(struct weston_keyboard *keyboard, const struct timespec *time,
|
|||||||
struct switcher *switcher;
|
struct switcher *switcher;
|
||||||
|
|
||||||
switcher = malloc(sizeof *switcher);
|
switcher = malloc(sizeof *switcher);
|
||||||
|
if (!switcher)
|
||||||
|
return;
|
||||||
|
|
||||||
switcher->shell = shell;
|
switcher->shell = shell;
|
||||||
switcher->current = NULL;
|
switcher->current = NULL;
|
||||||
switcher->listener.notify = switcher_handle_view_destroy;
|
switcher->listener.notify = switcher_handle_view_destroy;
|
||||||
|
|||||||
Reference in New Issue
Block a user