[PATCH wayland] Zero out the closure serializing buffer to make valgrind happy.

Jason Ekstrand jason at jlekstrand.net
Tue Apr 9 14:59:30 PDT 2013


Valgrind complains because sometimes padding at the ends of strings and arrays
is left uninitialized.  Zeroing out the buffer fixes this problem.

Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
 src/connection.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/connection.c b/src/connection.c
index 9425ca6..f79b6d0 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1018,6 +1018,8 @@ wl_closure_send(struct wl_closure *closure, struct wl_connection *connection)
 	uint32_t buffer[256];
 	int size;
 
+	memset(buffer, 0, sizeof buffer);
+
 	if (copy_fds_to_connection(closure, connection))
 		return -1;
 
@@ -1034,6 +1036,8 @@ wl_closure_queue(struct wl_closure *closure, struct wl_connection *connection)
 	uint32_t buffer[256];
 	int size;
 
+	memset(buffer, 0, sizeof buffer);
+
 	if (copy_fds_to_connection(closure, connection))
 		return -1;
 
-- 
1.8.1.4



More information about the wayland-devel mailing list