mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
cursor: Free theme when size check fails to avoid memory leak
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
This commit is contained in:
parent
cd0d1543c0
commit
264da6a92b
1 changed files with 3 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue