summaryrefslogtreecommitdiff
path: root/src/compositor-android.c
diff options
context:
space:
mode:
authorMartin Olsson <martin@minimum.se>2012-07-08 03:03:42 +0200
committerKristian Høgsberg <krh@bitplanet.net>2012-07-09 17:50:45 -0400
commitc5da0999fe55af38a05cd6f01fc416fc65c47e8a (patch)
treed3333034cbaa544abefcd2538d379b63bdc01a0e /src/compositor-android.c
parent712f5f405eabcb32e0af793dbe3feb6fe5b26cc4 (diff)
compositor-android: Add proper error handling in android_compositor_create()
Diffstat (limited to 'src/compositor-android.c')
-rw-r--r--src/compositor-android.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/compositor-android.c b/src/compositor-android.c
index 54cfa2e3..98956f61 100644
--- a/src/compositor-android.c
+++ b/src/compositor-android.c
@@ -419,31 +419,39 @@ android_compositor_create(struct wl_display *display, int argc, char *argv[],
if (weston_compositor_init(&compositor->base, display, argc, argv,
config_file) < 0)
- return NULL;
+ goto err_free;
compositor->base.destroy = android_compositor_destroy;
compositor->base.focus = 1;
- /* FIXME: all cleanup on failure is missing */
-
output = android_output_create(compositor);
if (!output)
- return NULL;
+ goto err_compositor;
if (android_init_egl(compositor, output) < 0)
- return NULL;
+ goto err_output;
if (weston_compositor_init_gl(&compositor->base) < 0)
- return NULL;
+ goto err_egl;
android_compositor_add_output(compositor, output);
compositor->seat = android_seat_create(compositor);
if (!compositor->seat)
- return NULL;
+ goto err_egl;
return &compositor->base;
+
+err_egl:
+ android_fini_egl(compositor);
+err_output:
+ android_output_destroy(&output->base);
+err_compositor:
+ weston_compositor_shutdown(&compositor->base);
+err_free:
+ free(compositor);
+ return NULL;
}
WL_EXPORT struct weston_compositor *