[PATCH wayland 1/9] connection: close_fds() should only remove fds it closed from the buffer
Derek Foreman
derekf at osg.samsung.com
Fri Apr 7 20:27:47 UTC 2017
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 at osg.samsung.com>
---
src/connection.c | 1 +
1 file changed, 1 insertion(+)
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;
--
2.11.0
More information about the wayland-devel
mailing list