449b7a0fd0c541fb77265e70e748b16cd625c6bc
[AGL/meta-agl.git] / meta-agl-profile-graphical / recipes-graphics / wayland / weston / 0001-ivi-shell-rework-goto-labels-to-avoid-memory-leaks.patch
1 index 67619b8f..e9ddf9a4 100644
2 --- a/ivi-shell/ivi-shell.c
3 +++ b/ivi-shell/ivi-shell.c
4 @@ -497,44 +497,53 @@ wet_shell_init(struct weston_compositor *compositor,
5  {
6         struct ivi_shell *shell;
7         struct ivi_shell_setting setting = { };
8 -       int retval = -1;
9  
10         shell = zalloc(sizeof *shell);
11         if (shell == NULL)
12                 return -1;
13  
14         if (ivi_shell_setting_create(&setting, compositor, argc, argv) != 0)
15 -               return -1;
16 +               goto err_shell;
17  
18         init_ivi_shell(compositor, shell, &setting);
19 +       /* TODO deinit_ivi_shell should be implemented, since init_ivi_shell is
20 +        * initializing multiple lists. */
21  
22         shell->destroy_listener.notify = shell_destroy;
23         wl_signal_add(&compositor->destroy_signal, &shell->destroy_listener);
24  
25         if (input_panel_setup(shell) < 0)
26 -               goto out_settings;
27 +               goto err_settings;
28  
29         shell->text_backend = text_backend_init(compositor);
30         if (!shell->text_backend)
31 -               goto out_settings;
32 +               goto err_settings;
33  
34         if (wl_global_create(compositor->wl_display,
35                              &ivi_application_interface, 1,
36                              shell, bind_ivi_application) == NULL)
37 -               goto out_settings;
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         /* Call module_init of ivi-modules which are defined in weston.ini */
46         if (load_controller_modules(compositor, setting.ivi_module,
47                                     argc, argv) < 0)
48 -               goto out_settings;
49 +               goto err_text_backend;
50 +
51 +       return IVI_SUCCEEDED;
52  
53 -       retval = 0;
54 +err_text_backend:
55 +       text_backend_destroy(shell->text_backend);
56  
57 -out_settings:
58 +err_settings:
59         free(setting.ivi_module);
60  
61 -       return retval;
62 +err_shell:
63 +       free(shell);
64 +
65 +       return IVI_FAILED;
66  }