From 3cc187c73ef73cd345138fd746344299f94933e8 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 22 May 2012 18:48:14 +0100 Subject: [PATCH] shm: Zero busy count for allocated buffers 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 file changed, 1 insertion(+) diff --git a/src/wayland-shm.c b/src/wayland-shm.c index 8a8a671..e071392 100644 --- a/src/wayland-shm.c +++ b/src/wayland-shm.c @@ -120,6 +120,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->offset = offset;