Upgrade to thud
[AGL/meta-agl.git] / meta-agl-profile-graphical / recipes-graphics / wayland / weston / 0001-ivi-shell-rework-goto-labels-to-avoid-memory-leaks.patch
1 diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
2 index 58f53bc5..34cdce27 100644
3 --- a/ivi-shell/ivi-shell.c
4 +++ b/ivi-shell/ivi-shell.c
5 @@ -484,13 +484,14 @@ wet_shell_init(struct weston_compositor *compositor,
6                int *argc, char *argv[])
7  {
8         struct ivi_shell *shell;
9 -       int retval = -1;
10  
11         shell = zalloc(sizeof *shell);
12         if (shell == NULL)
13 -               return -1;
14 +               goto err_shell;
15  
16         init_ivi_shell(compositor, shell);
17 +       /* TODO deinit_ivi_shell should be implemented, since init_ivi_shell is
18 +        * initializing multiple lists. */
19  
20         shell->destroy_listener.notify = shell_destroy;
21         wl_signal_add(&compositor->destroy_signal, &shell->destroy_listener);
22 @@ -499,22 +500,29 @@ wet_shell_init(struct weston_compositor *compositor,
23         wl_signal_add(&compositor->wake_signal, &shell->wake_listener);
24  
25         if (input_panel_setup(shell) < 0)
26 -               goto out;
27 +               goto err_shell;
28  
29         shell->text_backend = text_backend_init(compositor);
30         if (!shell->text_backend)
31 -               goto out;
32 +               goto err_shell;
33  
34         if (wl_global_create(compositor->wl_display,
35                              &ivi_application_interface, 1,
36                              shell, bind_ivi_application) == NULL)
37 -               goto out;
38 +               goto err_text_backend;
39  
40         ivi_layout_init_with_compositor(compositor);
41 +       /* TODO ivi_layout_destroy should be implemented, since multiple lists
42 +        * and signals are initialized.*/
43         shell_add_bindings(compositor, shell);
44  
45 -       retval = 0;
46 +       return IVI_SUCCEEDED;
47  
48 -out:
49 -       return retval;
50 +err_text_backend:
51 +       text_backend_destroy(shell->text_backend);
52 +
53 +err_shell:
54 +       free(shell);
55 +
56 +       return IVI_FAILED;
57  }