[PATCH weston 09/11] window: Free the allocated display if we fail to setup libxkbcommon

Rob Bradford robert.bradford at intel.com
Fri Jul 26 08:29:43 PDT 2013


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

---
 clients/window.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index 8d956ae..d9f7d5a 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -4970,6 +4970,13 @@ display_create(int *argc, char *argv[])
 		return NULL;
 	}
 
+	d->xkb_context = xkb_context_new(0);
+	if (d->xkb_context == NULL) {
+		fprintf(stderr, "Failed to create XKB context\n");
+		free(d);
+		return NULL;
+	}
+
 	d->epoll_fd = os_epoll_create_cloexec();
 	d->display_fd = wl_display_get_fd(d->display);
 	d->display_task.run = handle_display_data;
@@ -4981,12 +4988,6 @@ display_create(int *argc, char *argv[])
 	wl_list_init(&d->output_list);
 	wl_list_init(&d->global_list);
 
-	d->xkb_context = xkb_context_new(0);
-	if (d->xkb_context == NULL) {
-		fprintf(stderr, "Failed to create XKB context\n");
-		return NULL;
-	}
-
 	d->workspace = 0;
 	d->workspace_count = 1;
 
-- 
1.8.3.1



More information about the wayland-devel mailing list