From b18aec36253c7864d5c413d684a8d665b5b81640 Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Mon, 8 Apr 2024 10:12:14 -0400 Subject: [PATCH] tinywl: assert on memory allocation --- tinywl/tinywl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c index 6c043ed51..ead06fcf8 100644 --- a/tinywl/tinywl.c +++ b/tinywl/tinywl.c @@ -250,6 +250,7 @@ static void server_new_keyboard(struct tinywl_server *server, struct wlr_keyboard *wlr_keyboard = wlr_keyboard_from_input_device(device); struct tinywl_keyboard *keyboard = calloc(1, sizeof(*keyboard)); + assert(keyboard); keyboard->server = server; keyboard->wlr_keyboard = wlr_keyboard; @@ -625,6 +626,7 @@ static void server_new_output(struct wl_listener *listener, void *data) { /* Allocates and configures our state for this output */ struct tinywl_output *output = calloc(1, sizeof(*output)); + assert(output); output->wlr_output = wlr_output; output->server = server; @@ -801,6 +803,7 @@ static void server_new_xdg_toplevel(struct wl_listener *listener, void *data) { /* Allocate a tinywl_toplevel for this surface */ struct tinywl_toplevel *toplevel = calloc(1, sizeof(*toplevel)); + assert(toplevel); toplevel->server = server; toplevel->xdg_toplevel = xdg_toplevel; toplevel->scene_tree = @@ -859,6 +862,7 @@ static void server_new_xdg_popup(struct wl_listener *listener, void *data) { struct wlr_xdg_popup *xdg_popup = data; struct tinywl_popup *popup = calloc(1, sizeof(*popup)); + assert(popup); popup->xdg_popup = xdg_popup; /* We must add xdg popups to the scene graph so they get rendered. The