[PATCH] compositor: Check buffer is valid after retrieving it from the resource

Rob Bradford rob at robster.org.uk
Mon May 21 11:26:18 PDT 2012


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

---
 src/compositor.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index ba201af..83305f3 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2006,12 +2006,12 @@ pointer_attach(struct wl_client *client, struct wl_resource *resource,
 	if (buffer_resource)
 		buffer = buffer_resource->data;
 
-	weston_surface_attach(&seat->sprite->surface, buffer);
-	empty_region(&seat->sprite->input);
-
 	if (!buffer)
 		return;
 
+	weston_surface_attach(&seat->sprite->surface, buffer);
+	empty_region(&seat->sprite->input);
+
 	if (!weston_surface_is_mapped(seat->sprite)) {
 		wl_list_insert(&compositor->cursor_layer.surface_list,
 			       &seat->sprite->layer_link);
-- 
1.7.7.6



More information about the wayland-devel mailing list