[PATCH weston 2/3] xwayland: zalloc the x11_data_sources

Carlos Garnacho carlosg at gnome.org
Mon Feb 1 19:28:15 UTC 2016


The wrapped weston_data_source struct has new fields which were left
uninitialized, so its access is unreliable.

The data source in xwayland/dnd.c should be eventually setting the
drag-and-drop actions, but it is a lot more incomplete than that
(read: completely), so falls out of the scope of this patch.

Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
---
 xwayland/dnd.c       | 2 +-
 xwayland/selection.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xwayland/dnd.c b/xwayland/dnd.c
index a036b30..f17e4cd 100644
--- a/xwayland/dnd.c
+++ b/xwayland/dnd.c
@@ -162,7 +162,7 @@ handle_enter(struct weston_wm *wm, xcb_client_message_event_t *client_message)
 	xcb_get_property_cookie_t cookie;
 	xcb_get_property_reply_t *reply;
 
-	source = malloc(sizeof *source);
+	source = zalloc(sizeof *source);
 	if (source == NULL)
 		return;
 
diff --git a/xwayland/selection.c b/xwayland/selection.c
index 25ec848..3fcd578 100644
--- a/xwayland/selection.c
+++ b/xwayland/selection.c
@@ -197,7 +197,7 @@ weston_wm_get_selection_targets(struct weston_wm *wm)
 		return;
 	}
 
-	source = malloc(sizeof *source);
+	source = zalloc(sizeof *source);
 	if (source == NULL) {
 		free(reply);
 		return;
-- 
2.5.0



More information about the wayland-devel mailing list