diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-11-18 19:58:38 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-11-18 19:58:38 -0500 |
commit | 2f01a3265debaf8bb4b21a20033dc73b71ddb2e4 (patch) | |
tree | dadec05ec5abed8aed08ed4c74ab849d66bf3e1c | |
parent | Support cursors over wayland clients (diff) | |
download | sway-2f01a3265debaf8bb4b21a20033dc73b71ddb2e4.tar.gz sway-2f01a3265debaf8bb4b21a20033dc73b71ddb2e4.tar.zst sway-2f01a3265debaf8bb4b21a20033dc73b71ddb2e4.zip |
Exit if unable to allocate buffer
-rw-r--r-- | wayland/buffers.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/wayland/buffers.c b/wayland/buffers.c index 6117e10b..7cbf926f 100644 --- a/wayland/buffers.c +++ b/wayland/buffers.c | |||
@@ -57,6 +57,9 @@ static struct buffer *create_buffer(struct client_state *state, struct buffer *b | |||
57 | 57 | ||
58 | char *name; | 58 | char *name; |
59 | int fd = create_pool_file(size, &name); | 59 | int fd = create_pool_file(size, &name); |
60 | if (fd == -1) { | ||
61 | sway_abort("Unable to allocate buffer"); | ||
62 | } | ||
60 | void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); | 63 | void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); |
61 | struct wl_shm_pool *pool = wl_shm_create_pool(state->shm, fd, size); | 64 | struct wl_shm_pool *pool = wl_shm_create_pool(state->shm, fd, size); |
62 | buf->buffer = wl_shm_pool_create_buffer(pool, 0, width, height, stride, format); | 65 | buf->buffer = wl_shm_pool_create_buffer(pool, 0, width, height, stride, format); |