summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Paalanen <ppaalanen@gmail.com>2012-07-10 13:05:03 +0300
committerKristian Høgsberg <krh@bitplanet.net>2012-07-10 14:11:00 -0400
commit52e6dc71becf4ee7f473f8af79fd71f95b6889c0 (patch)
tree4162e0a04c9523d2ba6fc74cf0ab64f77597c36d
parenta88a4386cbf5f3a627345f12683210c3b81b292b (diff)
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>
-rw-r--r--cursor/wayland-cursor.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/cursor/wayland-cursor.c b/cursor/wayland-cursor.c
index c41860a..186ab6f 100644
--- a/cursor/wayland-cursor.c
+++ b/cursor/wayland-cursor.c
@@ -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);