mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
cursor: fix fd leak and a segfault
- don't leak fd in shm_pool_destroy() - return NULL from wl_cursor_theme_load() if pool fails Tha last one fixes a segfault, when shm_pool_create() has failed. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
parent
a88a4386cb
commit
52e6dc71be
1 changed files with 6 additions and 0 deletions
|
|
@ -108,6 +108,7 @@ shm_pool_destroy(struct shm_pool *pool)
|
|||
{
|
||||
munmap(pool->data, pool->size);
|
||||
wl_shm_pool_destroy(pool->pool);
|
||||
close(pool->fd);
|
||||
free(pool);
|
||||
}
|
||||
|
||||
|
|
@ -281,6 +282,11 @@ 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) {
|
||||
free(theme->name);
|
||||
free(theme);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xcursor_load_theme(name, size, load_callback, theme);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue