[PATCH 05/10] compositor-android: Add proper error handling in android_compositor_create()
Pekka Paalanen
ppaalanen at gmail.com
Sun Jul 8 00:46:33 PDT 2012
On Sun, 8 Jul 2012 03:03:42 +0200
Martin Olsson <martin at minimum.se> wrote:
> ---
> 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 *
Reviewed-by: Pekka Paalanen <ppaalanen at gmail.com>
Thanks,
pq
More information about the wayland-devel
mailing list