Fix memory leak 81/248481/1 submit/tizen/20201127.052752
authorJaehyun Kim <jeik01.kim@samsung.com>
Thu, 26 Nov 2020 11:26:04 +0000 (20:26 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Fri, 27 Nov 2020 05:07:07 +0000 (14:07 +0900)
Change-Id: I393ef9221b581b7c29c027428ec98cbd114e540d
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/network_interface.c
src/wifi_ap.c
src/wifi_internal.c

index 0e6a471..d387eec 100755 (executable)
@@ -2833,6 +2833,9 @@ int net_register_client_ext(network_info_s **network_info,
                }
        }
 
+       if (interface_list)
+               g_slist_free_full(interface_list, g_free);
+
        if (list == NULL) {
                WIFI_LOG(WIFI_ERROR, "Failed to find interface [%s]", interface_name);  //LCOV_EXCL_LINE
                _net_dbus_close_gdbus_call(net_info); //LCOV_EXCL_LINE
index a0e4f9e..75f1da7 100755 (executable)
@@ -398,6 +398,8 @@ EXPORT_API int wifi_manager_ap_destroy(wifi_manager_ap_h ap)
 
        CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
 
+       net_profile_info_s *ap_info = (net_profile_info_s *)ap;
+
        if (_wifi_check_ap_validity(ap) == false) {
                WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
                /* __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE */
@@ -406,6 +408,10 @@ EXPORT_API int wifi_manager_ap_destroy(wifi_manager_ap_h ap)
 
        _wifi_remove_from_ap_list(ap);
 
+       g_slist_free_full(ap_info->vsie_list, g_free);
+       g_slist_free_full(ap_info->bssid_list, g_free);
+       g_free(ap);
+
        /* __NETWORK_CAPI_FUNC_EXIT__; */
 
        return WIFI_MANAGER_ERROR_NONE;
@@ -471,6 +477,11 @@ EXPORT_API int wifi_manager_ap_refresh(wifi_manager_ap_h ap)
                return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
 
+       if (ap_info->vsie_list)
+               g_slist_free_full(ap_info->vsie_list, g_free);
+       if (ap_info->bssid_list)
+               g_slist_free_full(ap_info->bssid_list, g_free);
+
        memcpy(ap, &ap_info_local, sizeof(net_profile_info_s));
        ap_info->vsie_list = g_slist_copy_deep(ap_info_local.vsie_list,
                        _wifi_copy_vsie_list, NULL);
index 34c5cae..d8e7765 100755 (executable)
@@ -689,6 +689,12 @@ static void __state_changed_cb(wifi_manager_handle_s *wifi_handle, char *profile
                        wifi_handle->connection_state_user_data);
 
                _wifi_remove_from_ap_list(ap_info);
+
+               if (ap_info->vsie_list)
+                       g_slist_free_full(ap_info->vsie_list, g_free);
+               if (ap_info->bssid_list)
+                       g_slist_free_full(ap_info->bssid_list, g_free);
+
                g_free(ap_info);
        }
 }