[PATCH] clipboard: initialise clipboard memory after creation

Rafal Mielniczuk rafal.mielniczuk2 at gmail.com
Sat Jun 30 09:33:34 PDT 2012


In case we don't, weston segfault in clipboard_set_selection
on:
if (clipboard->source)
		clipboard_source_unref(clipboard->source);
---
 src/clipboard.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/clipboard.c b/src/clipboard.c
index 92c8a83..22d4b26 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -251,6 +251,7 @@ clipboard_create(struct weston_seat *seat)
 	clipboard = malloc(sizeof *clipboard);
 	if (clipboard == NULL)
 		return NULL;
+	memset(clipboard, 0, sizeof *clipboard);
 
 	clipboard->seat = seat;
 	clipboard->selection_listener.notify = clipboard_set_selection;
-- 
1.7.11.1



More information about the wayland-devel mailing list