[PATCH 3/3] initialise display

Tim Wiederhake twied at gmx.net
Sun Jan 23 14:25:26 PST 2011


fixes valgrind:
==25178== Conditional jump or move depends on uninitialised value(s)
==25178==    at 0x409E2C: display_create (window.c:1582)
==25178==    by 0x407A43: main (terminal.c:2323)
and
==13793== Conditional jump or move depends on uninitialised value(s)
==13793==    at 0x40A2D1: display_handle_global (window.c:1504)
==13793==    by 0x4E2C183: display_handle_global (wayland-client.c:281)
==13793==    by 0x713FEE7: ffi_call_unix64 (in /usr/lib/libffi.so.5.0.10)
==13793==    by 0x713FC83: ffi_call (in /usr/lib/libffi.so.5.0.10)
==13793==    by 0x4E2C71A: wl_closure_invoke (connection.c:663)
==13793==    by 0x4E2BB7B: wl_display_iterate (wayland-client.c:484)
==13793==    by 0x4096CA: display_create (window.c:1664)
==13793==    by 0x407A43: main (terminal.c:2321)
---
 clients/window.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index 2944287..59ea975 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1647,6 +1647,8 @@ display_create(int *argc, char **argv[], const GOptionEntry *option_entries)
 	if (d == NULL)
 		return NULL;
 
+        memset(d, 0, sizeof *d);
+
 	d->display = wl_display_connect(NULL);
 	if (d->display == NULL) {
 		fprintf(stderr, "failed to create display: %m\n");
-- 
1.7.2.3



More information about the wayland-devel mailing list