[PATCH 3/3] shm: Avoid file descriptor leak upon unsuccessful mmap

Lubomir Rintel lkundrak at v3.sk
Fri Nov 15 05:17:56 PST 2013


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 at v3.sk>
---
 src/wayland-shm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/wayland-shm.c b/src/wayland-shm.c
index ad92dba..0bae6da 100644
--- a/src/wayland-shm.c
+++ b/src/wayland-shm.c
@@ -248,7 +248,7 @@ shm_create_pool(struct wl_client *client, struct wl_resource *resource,
 		wl_resource_post_error(resource,
 				       WL_SHM_ERROR_INVALID_FD,
 				       "failed mmap fd %d", fd);
-		goto err_free;
+		goto err_close;
 	}
 	close(fd);
 
-- 
1.8.4.2



More information about the wayland-devel mailing list