Remove memory leakage 72/116372/1 accepted/tizen/mobile/20170224.065600 accepted/tizen/unified/20170309.074824 submit/tizen/20170224.044213 submit/tizen_unified/20170308.100419 submit/tizen_unified/20170309.100418
authorKiseok Chang <kiso.chang@samsung.com>
Fri, 24 Feb 2017 04:37:53 +0000 (13:37 +0900)
committerKiseok Chang <kiso.chang@samsung.com>
Fri, 24 Feb 2017 04:38:22 +0000 (13:38 +0900)
Change-Id: I6b8b222ce5fe169a0b94beb0a94f92577f2c3a5f
Signed-off-by: Kiseok Chang <kiso.chang@samsung.com>
setting-network/src/setting-network-con-list.c
setting-network/src/setting-network-profile-delete.c [changed mode: 0644->0755]

index 032b060893a62b7d2b7a3c4d0b1923e179ab485f..0d4872226533666d07e4ad2012fd588e202cd6e4 100755 (executable)
@@ -196,7 +196,7 @@ static int __con_list_recreate(void *cb)
 
        s_info.selected_profile = NULL;
        EINA_LIST_FOREACH(ad->profile_list, elist, profile_h) {
-               apn = name = NULL;
+               apn = name = proxy_address = id = NULL;
                connection_profile_get_cellular_apn(profile_h, &apn);
                connection_profile_get_name(profile_h, &name);
                connection_profile_get_proxy_address(profile_h,
@@ -205,8 +205,15 @@ static int __con_list_recreate(void *cb)
 
                item_data = (Setting_GenGroupItem_Data *)
                                calloc(1, sizeof(Setting_GenGroupItem_Data));
-               setting_retvm_if(!item_data, SETTING_RETURN_FAIL,
-                               "calloc failed");
+               if (0 == item_data) {
+                       SETTING_TRACE_ERROR("calloc failed");
+                       G_FREE(apn);
+                       G_FREE(name);
+                       G_FREE(proxy_address);
+                       G_FREE(id);
+                       return SETTING_RETURN_FAIL;
+               }
+
                item_data->keyStr = (char *)g_strdup(name);
                item_data->swallow_type =
                                SWALLOW_TYPE_1RADIO_RIGHT_PROPAGATE_EVENTS_SET;
@@ -271,6 +278,7 @@ static int __con_list_recreate(void *cb)
                G_FREE(name);
                G_FREE(proxy_address);
                G_FREE(id);
+
                idx++;
        }
 
old mode 100644 (file)
new mode 100755 (executable)
index 1716976..36b4c6b
@@ -87,11 +87,16 @@ static void __profile_delete_list_draw(SettingNetwork *ad)
                        continue;
                apn = name = proxy_address = id = NULL;
                connection_profile_get_cellular_apn(profile_h, &apn);
-               if (isEmptyStr(apn))
+               if (isEmptyStr(apn)) {
+                       G_FREE(apn);
                        continue;
+               }
                connection_profile_get_name(profile_h, &name);
-               if (isEmptyStr(name))
+               if (isEmptyStr(name)) {
+                       G_FREE(apn);
+                       G_FREE(name);
                        continue;
+               }
                connection_profile_get_proxy_address(profile_h,
                                CONNECTION_ADDRESS_FAMILY_IPV4, &proxy_address);
                connection_profile_get_id(profile_h, &id);
@@ -111,6 +116,9 @@ static void __profile_delete_list_draw(SettingNetwork *ad)
                if (0 == item_data) {
                        SETTING_TRACE_ERROR("calloc failed");
                        G_FREE(apn);
+                       G_FREE(name);
+                       G_FREE(proxy_address);
+                       G_FREE(id);
                        return;
                }
                item_data->keyStr = (char *)g_strdup(name);
@@ -129,6 +137,11 @@ static void __profile_delete_list_draw(SettingNetwork *ad)
                s_info.profile_del_list = eina_list_append(s_info.profile_del_list,
                                item_data);
 
+               G_FREE(apn);
+               G_FREE(name);
+               G_FREE(proxy_address);
+               G_FREE(id);
+
                idx++;
        }
 
@@ -155,10 +168,7 @@ static void __profile_delete_list_draw(SettingNetwork *ad)
                        elm_object_disabled_set(allbtn, EINA_TRUE);
                SETTING_TRACE("To disable");
        }
-       G_FREE(apn);
-       G_FREE(name);
-       G_FREE(proxy_address);
-       G_FREE(id);
+
        return;
 }