From c5da0999fe55af38a05cd6f01fc416fc65c47e8a Mon Sep 17 00:00:00 2001 From: Martin Olsson Date: Sun, 8 Jul 2012 03:03:42 +0200 Subject: [PATCH] compositor-android: Add proper error handling in android_compositor_create() --- src/compositor-android.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/compositor-android.c b/src/compositor-android.c index 54cfa2e..98956f6 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 * -- 2.7.4