Fixed various memory leaks
[platform/upstream/connman.git] / src / network.c
index cf74b6d..e189955 100755 (executable)
@@ -115,6 +115,12 @@ struct connman_network {
                int disconnect_reason;
                int assoc_status_code;
                GSList *vsie_list;
+               /*
+               * Only for EAP-FAST
+               */
+               char *phase1;
+               unsigned char country_code[WIFI_COUNTRY_CODE_LEN];
+               GSList *bssid_list;
 #endif
        } wifi;
 
@@ -980,6 +986,7 @@ static void network_destruct(struct connman_network *network)
        g_free(network->wifi.pin_wps);
 #if defined TIZEN_EXT
        g_slist_free_full(network->wifi.vsie_list, g_free);
+       g_slist_free_full(network->wifi.bssid_list, g_free);
 #endif
        g_free(network->path);
        g_free(network->group);
@@ -2072,6 +2079,42 @@ int connman_network_get_assoc_status_code(struct connman_network *network)
 
        return network->wifi.assoc_status_code;
 }
+
+int connman_network_set_countrycode(struct connman_network *network,
+                                   const unsigned char *country_code)
+{
+       int i = 0;
+
+       if (country_code == NULL)
+               return -EINVAL;
+
+       DBG("network %p Country Code %02x:%02x",network,
+           country_code[0],country_code[1]);
+
+       for (; i < WIFI_COUNTRY_CODE_LEN; i++)
+               network->wifi.country_code[i] = country_code[i];
+
+       return 0;
+}
+
+unsigned char *connman_network_get_countrycode(struct connman_network *network)
+{
+       return (unsigned char *)network->wifi.country_code;
+}
+
+int connman_network_set_bssid_list(struct connman_network *network,
+                                       GSList *bssids)
+{
+       g_slist_free_full(network->wifi.bssid_list, g_free);
+       network->wifi.bssid_list = bssids;
+
+       return 0;
+}
+
+void *connman_network_get_bssid_list(struct connman_network *network)
+{
+       return network->wifi.bssid_list;
+}
 #endif
 
 int connman_network_set_nameservers(struct connman_network *network,
@@ -2397,6 +2440,7 @@ bool connman_network_get_bool(struct connman_network *network,
  */
 void connman_network_set_vsie_list(struct connman_network *network, GSList *vsie_list)
 {
+       g_slist_free_full(network->wifi.vsie_list, g_free);
        network->wifi.vsie_list = vsie_list;
 }