aboutsummaryrefslogtreecommitdiffstats
path: root/src/connection.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-04-13 11:51:43 -0500
committerDaniel Stone <daniels@collabora.com>2017-12-04 22:21:37 +0000
commit971a9e7873e43f3bd059b340e1e9bfa65b384e47 (patch)
tree62dc1b669573353b765bec4a98951c180b7bff4d /src/connection.c
parentDo not create man page links with doxygen (diff)
downloadwayland-971a9e7873e43f3bd059b340e1e9bfa65b384e47.tar
wayland-971a9e7873e43f3bd059b340e1e9bfa65b384e47.tar.gz
wayland-971a9e7873e43f3bd059b340e1e9bfa65b384e47.tar.bz2
wayland-971a9e7873e43f3bd059b340e1e9bfa65b384e47.tar.lz
wayland-971a9e7873e43f3bd059b340e1e9bfa65b384e47.tar.xz
wayland-971a9e7873e43f3bd059b340e1e9bfa65b384e47.tar.zst
wayland-971a9e7873e43f3bd059b340e1e9bfa65b384e47.zip
connection: close_fds() should only remove fds it closed from the buffer
All current callers close all fds, so this has gone unnoticed, but if we close less than all fds with close_fds() we leak all the unclosed ones and ruin further event demarshalling. A future patch will close less than the full buffer's worth of fds, so this is now noticed. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'src/connection.c')
-rw-r--r--src/connection.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/connection.c b/src/connection.c
index 5c3d187..7fe35b5 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -186,6 +186,7 @@ close_fds(struct wl_buffer *buffer, int max)
count = size / sizeof fds[0];
if (max > 0 && max < count)
count = max;
+ size = count * sizeof fds[0];
for (i = 0; i < count; i++)
close(fds[i]);
buffer->tail += size;