e_mod_rotation_wl: fix resource leak 32/249832/2
authorDoyoun Kang <doyoun.kang@samsung.com>
Thu, 17 Dec 2020 04:29:09 +0000 (13:29 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Thu, 17 Dec 2020 04:34:54 +0000 (13:34 +0900)
Change-Id: Id056103878eaa31971c97edac6952fc8fc08b6bb

src/rotation/e_mod_rotation_wl.c

index c653bbc..26f8069 100644 (file)
@@ -100,6 +100,7 @@ static Eina_List *wl_hooks = NULL;
 static Eina_List *pol_vis_hooks = NULL;
 static Ecore_Idle_Enterer *rot_idle_enterer = NULL;
 static E_Client *fg_ec = NULL;
+static struct wl_global *rot_global;
 
 /* local subsystem functions */
 static Policy_Ext_Rotation* _policy_ext_rotation_get(E_Client *ec);
@@ -2919,8 +2920,9 @@ e_mod_rot_wl_init(void)
    EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl->wl.disp, EINA_FALSE);
 
-   if (!wl_global_create(e_comp_wl->wl.disp, &tizen_policy_ext_interface, 3,
-                         NULL, _e_tizen_policy_ext_bind_cb))
+   rot_global = wl_global_create(e_comp_wl->wl.disp, &tizen_policy_ext_interface, 3,
+                                 NULL, _e_tizen_policy_ext_bind_cb);
+   if (!rot_global)
      {
         ERR("Could not add tizen_policy_ext to wayland globals: %m");
         return EINA_FALSE;
@@ -2958,6 +2960,12 @@ e_mod_rot_wl_shutdown(void)
    E_FREE_LIST(rot_cbs, ecore_event_handler_del);
    E_FREE_LIST(rot_obj_hooks, e_comp_object_intercept_hook_del);
 
+   if (rot_global)
+     {
+        wl_global_destroy(rot_global);
+        rot_global = NULL;
+     }
+
    if (rot_idle_enterer)
      {
          ecore_idle_enterer_del(rot_idle_enterer);