[PATCH 2/2] shm: Zero busy count for allocated buffers

Rob Bradford rob at robster.org.uk
Tue May 22 10:48:14 PDT 2012


From: Rob Bradford <rob at linux.intel.com>

This avoids a valgrind error like:

==31496== Conditional jump or move depends on uninitialised value(s)
==31496==    at 0x407620: weston_buffer_post_release (compositor.c:928)
==31496==    by 0x406AEB: weston_surface_attach (compositor.c:725)
==31496==    by 0x409EB8: pointer_attach (compositor.c:2009)
==31496==    by 0x34ECE05D63: ffi_call_unix64 (unix64.S:75)
==31496==    by 0x34ECE05784: ffi_call (ffi64.c:486)
==31496==    by 0x5674C4D: wl_closure_invoke (connection.c:770)
==31496==    by 0x566ECCB: wl_client_connection_data (wayland-server.c:255)
==31496==    by 0x56722F9: wl_event_source_fd_dispatch (event-loop.c:79)
==31496==    by 0x5672C99: wl_event_loop_dispatch (event-loop.c:410)
==31496==    by 0x56705FF: wl_display_run (wayland-server.c:1004)
==31496==    by 0x40C775: main (compositor.c:2937)
==31496==  Uninitialised value was created by a heap allocation
==31496==    at 0x4A074CD: malloc (vg_replace_malloc.c:236)
==31496==    by 0x5670EA7: shm_pool_create_buffer (wayland-shm.c:113)
==31496==    by 0x34ECE05D63: ffi_call_unix64 (unix64.S:75)
==31496==    by 0x34ECE05784: ffi_call (ffi64.c:486)
==31496==    by 0x5674C4D: wl_closure_invoke (connection.c:770)
==31496==    by 0x566ECCB: wl_client_connection_data (wayland-server.c:255)
==31496==    by 0x56722F9: wl_event_source_fd_dispatch (event-loop.c:79)
==31496==    by 0x5672C99: wl_event_loop_dispatch (event-loop.c:410)
==31496==    by 0x56705FF: wl_display_run (wayland-server.c:1004)
==31496==    by 0x40C775: main (compositor.c:2937)
---
 src/wayland-shm.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/wayland-shm.c b/src/wayland-shm.c
index 7900ba1..487180e 100644
--- a/src/wayland-shm.c
+++ b/src/wayland-shm.c
@@ -118,6 +118,7 @@ shm_pool_create_buffer(struct wl_client *client, struct wl_resource *resource,
 
 	buffer->buffer.width = width;
 	buffer->buffer.height = height;
+	buffer->buffer.busy_count = 0;
 	buffer->format = format;
 	buffer->stride = stride;
 	buffer->data = pool->data + offset;
-- 
1.7.7.6



More information about the wayland-devel mailing list