ivi-shell: rework goto labels to avoid memory leaks

Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
This commit is contained in:
Michael Teyfel 2017-09-26 17:12:08 +02:00 committed by Daniel Stone
parent 1ed3506b70
commit f2042e132e

View file

@ -461,7 +461,6 @@ wet_shell_init(struct weston_compositor *compositor,
int *argc, char *argv[])
{
struct ivi_shell *shell;
int retval = -1;
shell = zalloc(sizeof *shell);
if (shell == NULL)
@ -478,13 +477,15 @@ wet_shell_init(struct weston_compositor *compositor,
if (wl_global_create(compositor->wl_display,
&ivi_application_interface, 1,
shell, bind_ivi_application) == NULL)
goto out;
goto err_shell;
ivi_layout_init_with_compositor(compositor);
shell_add_bindings(compositor, shell);
retval = 0;
return IVI_SUCCEEDED;
out:
return retval;
err_shell:
free(shell);
return IVI_FAILED;
}