diff options
| author | YaoBing Xiao <xiaoyaobing@uniontech.com> | 2025-07-16 22:29:40 +0800 |
|---|---|---|
| committer | Simon Ser <contact@emersion.fr> | 2025-08-03 11:36:34 +0000 |
| commit | 264da6a92b48ef41661021236c5d51ca52722309 (patch) | |
| tree | 583e4867a5dec966c2bafc792cf3debb0f435658 | |
| parent | ci: upgrade FreeBSD to 14.3 (diff) | |
| download | wayland-264da6a92b48ef41661021236c5d51ca52722309.tar wayland-264da6a92b48ef41661021236c5d51ca52722309.tar.gz wayland-264da6a92b48ef41661021236c5d51ca52722309.tar.bz2 wayland-264da6a92b48ef41661021236c5d51ca52722309.tar.lz wayland-264da6a92b48ef41661021236c5d51ca52722309.tar.xz wayland-264da6a92b48ef41661021236c5d51ca52722309.tar.zst wayland-264da6a92b48ef41661021236c5d51ca52722309.zip | |
cursor: Free theme when size check fails to avoid memory leak
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
| -rw-r--r-- | cursor/wayland-cursor.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cursor/wayland-cursor.c b/cursor/wayland-cursor.c index 89ecc9a..2e21db7 100644 --- a/cursor/wayland-cursor.c +++ b/cursor/wayland-cursor.c @@ -398,7 +398,7 @@ wl_cursor_theme_load(const char *name, int size, struct wl_shm *shm) return NULL; if (size < 0 || (size > 0 && INT_MAX / size / 4 < size)) - return NULL; + goto err; if (!name) name = "default"; @@ -409,7 +409,7 @@ wl_cursor_theme_load(const char *name, int size, struct wl_shm *shm) theme->pool = shm_pool_create(shm, size * size * 4); if (!theme->pool) - goto out_error_pool; + goto err; xcursor_load_theme(name, size, load_callback, theme); @@ -421,7 +421,7 @@ wl_cursor_theme_load(const char *name, int size, struct wl_shm *shm) return theme; -out_error_pool: +err: free(theme); return NULL; } |
