Resolve possibe Memory Leak 82/179382/1
authorNilesh Trimbake <t.shripati@samsung.com>
Thu, 17 May 2018 11:39:54 +0000 (17:09 +0530)
committerNilesh Trimbake <t.shripati@samsung.com>
Thu, 17 May 2018 11:39:54 +0000 (17:09 +0530)
This patch resolve posible
memory leak.

Change-Id: I80720fbe5691eb0d051d4eab1bc483196c2482c3

src/grid.c
src/ui_manager.c

index d5e26040172d4a2718e41cd15461cfa16afe9a85..8f622f2e3b0728e638b95591562280d07750dbf4 100644 (file)
@@ -214,7 +214,13 @@ static Evas_Object *__content_get(void *data, Evas_Object *obj, const char *part
 
 static void __del(void *data, Evas_Object *obj)
 {
+       content_s* info = data;
        ret_if(NULL == data);
+
+       if (info->icon_path) {
+               free(info->icon_path);
+               info->icon_path = NULL;
+       }
 }
 
 
index 5d377788fdce9e05e242a0da3d822e1726083d3b..34a3a54a788528f6866d1ea5ab4d2af85fe4618f 100644 (file)
@@ -224,7 +224,10 @@ ERROR:
        if (content_info->tabbar_item) _toolbar_remove_item(attach_panel->toolbar, content_info->tabbar_item);
        if (content_info->content) _ui_manager_destroy_content(content_info, attach_panel);
        if (page) _page_destroy(page);
-       if (content_info->icon_path) free(content_info->icon_path);
+       if (content_info->icon_path) {
+               free(content_info->icon_path);
+               content_info->icon_path = NULL;
+       }
        free(content_info);
 
        return ATTACH_PANEL_ERROR_NOT_INITIALIZED;
@@ -257,7 +260,10 @@ void _ui_manager_remove_content_category(Evas_Object *ui_manager, content_s *con
        }
 
        attach_panel->content_list = eina_list_remove(attach_panel->content_list, content_info);
-       if (content_info->icon_path) free(content_info->icon_path);
+       if (content_info->icon_path) {
+               free(content_info->icon_path);
+               content_info->icon_path = NULL;
+       }
        free(content_info);
 
        if (page_removed) {
@@ -307,7 +313,10 @@ static void __remove_content_categories(Evas_Object *ui_manager)
                        _page_destroy(page);
                }
                _toolbar_remove_item(attach_panel->toolbar, content_info->tabbar_item);
-               if (content_info->icon_path) free(content_info->icon_path);
+               if (content_info->icon_path) {
+                       free(content_info->icon_path);
+                       content_info->icon_path = NULL;
+               }
                free(content_info);
        }
 }