ivi-shell: rework goto labels to avoid memory leaks

Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
dev
Michael Teyfel 7 years ago committed by Daniel Stone
parent 1ed3506b70
commit f2042e132e
  1. 11
      ivi-shell/ivi-shell.c

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

Loading…
Cancel
Save