Fix crash issue 86/184286/2
authorchleun.moon <chleun.moon@samsung.com>
Tue, 17 Jul 2018 04:31:50 +0000 (13:31 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Tue, 17 Jul 2018 04:33:09 +0000 (13:33 +0900)
Change-Id: Ia9035c8f4e36e5d6996917f87e0d5d08adc09907
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
packaging/capi-network-wifi-manager.spec
src/wifi_internal.c

index d802ad2..c115057 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          capi-network-wifi-manager
 Summary:       Network Wi-Fi library in TIZEN C API
-Version:       1.0.38
+Version:       1.0.39
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index 72bf7a9..deebdb3 100755 (executable)
@@ -1517,6 +1517,31 @@ int _wifi_get_callback_count_from_handle_list(wifi_manager_handle_cb_e e)
        return count;
 }
 
+void config_free(gpointer data)
+{
+       wifi_config_s *h = (wifi_config_s *)data;
+       g_free(h->name);
+       g_free(h->passphrase);
+       g_free(h->proxy_address);
+       if (h->eap_config) {
+               g_free(h->eap_config->ca_cert);
+               g_free(h->eap_config->client_cert);
+               g_free(h->eap_config->private_key);
+               g_free(h->eap_config->anonymous_identity);
+               g_free(h->eap_config->identity);
+               g_free(h->eap_config->subject_match);
+               g_free(h->eap_config);
+       }
+}
+
+void __clear_config_list(GSList **iterator)
+{
+       if (*iterator) {
+               g_slist_free_full(*iterator, config_free);
+               *iterator = NULL;
+       }
+}
+
 bool _wifi_deinit(void)
 {
        int rv = net_deregister_client_ext();
@@ -1533,8 +1558,7 @@ bool _wifi_deinit(void)
        g_slist_free_full(config_handle_list, g_free);
        config_handle_list = NULL;
 
-       g_slist_free_full(config_iterator, g_free);
-       config_iterator = NULL;
+       __clear_config_list(&config_iterator);
 
        return true;
 }
@@ -2803,7 +2827,7 @@ int _wifi_load_configurations(void)
        int rv;
        GSList *config_ids = NULL;
 
-       __clear_profile_list(&config_iterator);
+       __clear_config_list(&config_iterator);
 
        rv = _wifi_config_get_config_id_list(&config_ids);
        if (rv != WIFI_MANAGER_ERROR_NONE) {