Exit if unable to allocate buffer

master
Drew DeVault 9 years ago
parent 7a40eb6de6
commit 2f01a3265d

@ -57,6 +57,9 @@ static struct buffer *create_buffer(struct client_state *state, struct buffer *b
char *name; char *name;
int fd = create_pool_file(size, &name); int fd = create_pool_file(size, &name);
if (fd == -1) {
sway_abort("Unable to allocate buffer");
}
void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
struct wl_shm_pool *pool = wl_shm_create_pool(state->shm, fd, size); struct wl_shm_pool *pool = wl_shm_create_pool(state->shm, fd, size);
buf->buffer = wl_shm_pool_create_buffer(pool, 0, width, height, stride, format); buf->buffer = wl_shm_pool_create_buffer(pool, 0, width, height, stride, format);

Loading…
Cancel
Save