aboutsummaryrefslogtreecommitdiff
path: root/wayland.c
diff options
context:
space:
mode:
authorCraig Barnes <craigbarnes@protonmail.com>2020-08-09 07:55:20 +0000
committerCraig Barnes <craigbarnes@protonmail.com>2020-08-09 07:55:20 +0000
commit4e6100494c4fdea43cb95df1abb68958a89d7935 (patch)
treecb2539f90c8a1be1ae330c807997dfc2a98e9481 /wayland.c
parentConvert most dynamic allocations to use functions from xmalloc.h (diff)
Handle allocation failures explicitly in *_init() functions
Diffstat (limited to 'wayland.c')
-rw-r--r--wayland.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/wayland.c b/wayland.c
index 2b5ab9b8..5f12d531 100644
--- a/wayland.c
+++ b/wayland.c
@@ -974,7 +974,12 @@ fdm_wayl(struct fdm *fdm, int fd, int events, void *data)
struct wayland *
wayl_init(const struct config *conf, struct fdm *fdm)
{
- struct wayland *wayl = xcalloc(1, sizeof(*wayl));
+ struct wayland *wayl = calloc(1, sizeof(*wayl));
+ if (unlikely(wayl == NULL)) {
+ LOG_ERRNO("calloc() failed");
+ return NULL;
+ }
+
wayl->conf = conf;
wayl->fdm = fdm;
wayl->fd = -1;
@@ -1131,7 +1136,12 @@ wayl_win_init(struct terminal *term)
struct wayland *wayl = term->wl;
const struct config *conf = term->conf;
- struct wl_window *win = xcalloc(1, sizeof(*win));
+ struct wl_window *win = calloc(1, sizeof(*win));
+ if (unlikely(win == NULL)) {
+ LOG_ERRNO("calloc() failed");
+ return NULL;
+ }
+
win->term = term;
win->use_csd = CSD_UNKNOWN;
win->csd.move_timeout_fd = -1;