aboutsummaryrefslogtreecommitdiffstats
path: root/cursor/wayland-cursor.c
diff options
context:
space:
mode:
authorYaoBing Xiao <xiaoyaobing@uniontech.com>2024-10-18 10:25:21 +0800
committerYaoBing Xiao <xiaoyaobing@uniontech.com>2024-10-18 16:49:45 +0800
commitf67db75ec118f6ec64e60113dbdecb20b4ea1abd (patch)
treec95a1df198f778895987432fa99ac1594b123cc6 /cursor/wayland-cursor.c
parentprotocol: document that wl_surface.offset is role-specific (diff)
downloadwayland-f67db75ec118f6ec64e60113dbdecb20b4ea1abd.tar
wayland-f67db75ec118f6ec64e60113dbdecb20b4ea1abd.tar.gz
wayland-f67db75ec118f6ec64e60113dbdecb20b4ea1abd.tar.bz2
wayland-f67db75ec118f6ec64e60113dbdecb20b4ea1abd.tar.lz
wayland-f67db75ec118f6ec64e60113dbdecb20b4ea1abd.tar.xz
wayland-f67db75ec118f6ec64e60113dbdecb20b4ea1abd.tar.zst
wayland-f67db75ec118f6ec64e60113dbdecb20b4ea1abd.zip
cursor: add check to ensure wl_shm_create_pool succeeded
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
Diffstat (limited to 'cursor/wayland-cursor.c')
-rw-r--r--cursor/wayland-cursor.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cursor/wayland-cursor.c b/cursor/wayland-cursor.c
index 156f0a8..636f516 100644
--- a/cursor/wayland-cursor.c
+++ b/cursor/wayland-cursor.c
@@ -68,11 +68,16 @@ shm_pool_create(struct wl_shm *shm, int size)
goto err_close;
pool->pool = wl_shm_create_pool(shm, pool->fd, size);
+ if (!pool->pool)
+ goto err_unmap;
+
pool->size = size;
pool->used = 0;
return pool;
+err_unmap:
+ munmap(pool->data, size);
err_close:
close(pool->fd);
err_free: