shm: Avoid file descriptor leak upon unsuccessful mmap

It would be possible to make the compositor leak file descriptors by
passing descriptors of open unmmapable files to it, such as /dev/null.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
This commit is contained in:
Lubomir Rintel 2013-11-15 14:17:56 +01:00 committed by Kristian Høgsberg
parent c2bba88ccd
commit 4a196570a3

View file

@ -241,7 +241,7 @@ shm_create_pool(struct wl_client *client, struct wl_resource *resource,
wl_resource_post_error(resource, wl_resource_post_error(resource,
WL_SHM_ERROR_INVALID_FD, WL_SHM_ERROR_INVALID_FD,
"failed mmap fd %d", fd); "failed mmap fd %d", fd);
goto err_free; goto err_close;
} }
close(fd); close(fd);