summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaurav Babu <saurav.babu@samsung.com>2018-05-24 12:01:54 +0530
committerSaurav Babu <saurav.babu@samsung.com>2018-05-24 15:38:33 +0530
commitea06d6f89f3860358c26de964e935c51718489b4 (patch)
tree73063cd0eee59956ae9f31528f59a28dd04ba936
parent146f8947c8f8e7c16802d8a653ab0e01e09b4a01 (diff)
downloadconnman-ea06d6f89f3860358c26de964e935c51718489b4.tar.gz
connman-ea06d6f89f3860358c26de964e935c51718489b4.tar.bz2
connman-ea06d6f89f3860358c26de964e935c51718489b4.zip
Fixed various memory leaks
Below are few of the valgrind outputs: ==2694== 7,484 (576 direct, 6,908 indirect) bytes in 72 blocks are definitely lost in loss record 196 of 197 ==2694== at 0x48458A4: malloc (vg_replace_malloc.c:299) ==2694== by 0x48C11B3: g_malloc (gmem.c:94) ==2694== by 0x48DA4A3: g_slice_alloc (gslice.c:1025) ==2694== by 0x48DBA13: g_slist_append (gslist.c:213) ==2694== by 0x12EF29: g_supplicant_network_get_wifi_vsie(supplicant.c:1605) ==2694== by 0x127097: network_added (wifi.c:3447) ==2694== by 0x12A41D: callback_network_added (supplicant.c:624) ==2694== by 0x12A41D: add_or_replace_bss_to_network(supplicant.c:1967) ==2694== by 0x12B9C9: interface_bss_added_with_keys(supplicant.c:2457) ==2694== by 0x12B9C9: signal_bss_added (supplicant.c:3106) ==2694== by 0x12AF1D: g_supplicant_filter (supplicant.c:4045) ==2694== by 0x49904EB: dbus_connection_dispatch (in/usr/lib/libdbus-1.so.3.14.6) ==2694== by 0x18E921: message_dispatch (mainloop.c:76) ==2694== by 0x48BB8E7: g_main_dispatch (gmain.c:3234) ==2694== by 0x48BB8E7: g_main_context_dispatch (gmain.c:3887) ==2694== 1,980 (304 direct, 1,676 indirect) bytes in 38 blocks are definitely lost in loss record 187 of 197 ==2694== at 0x48458A4: malloc (vg_replace_malloc.c:299) ==2694== by 0x48C11B3: g_malloc (gmem.c:94) ==2694== by 0x48DA4A3: g_slice_alloc (gslice.c:1025) ==2694== by 0x48DBA13: g_slist_append (gslist.c:213) ==2694== by 0x128D3F: update_bssid_list (supplicant.c:1637) ==2694== by 0x48A989F: g_hash_table_foreach (ghash.c:1610) ==2694== by 0x12EF91: g_supplicant_network_get_bssid_list(supplicant.c:1649) ==2694== by 0x127177: network_added (wifi.c:3489) ==2694== by 0x1294D5: callback_network_added (supplicant.c:624) ==2694== by 0x1294D5: scan_network_update (supplicant.c:2810) ==2694== by 0x130151: supplicant_dbus_array_foreach (dbus.c:106) ==2694== by 0x1298E3: scan_bss_data (supplicant.c:2824) ==2694== by 0x130071: property_get_reply (dbus.c:273) ==2694== 28 bytes in 2 blocks are definitely lost in loss record 87 of 197 ==2694== at 0x48458A4: malloc (vg_replace_malloc.c:299) ==2694== by 0x48C11B3: g_malloc (gmem.c:94) ==2694== by 0x48DBF03: g_strdup (gstrfuncs.c:363) ==2694== by 0x12A65B: merge_network (supplicant.c:1737) ==2694== by 0x12A7D9: network_property (supplicant.c:1758) ==2694== by 0x12A7D9: interface_network_added (supplicant.c:1808) ==2694== by 0x12AF1D: g_supplicant_filter (supplicant.c:4045) ==2694== by 0x49904EB: dbus_connection_dispatch (in /usr/lib/libdbus-1.so.3.14.6) ==2694== by 0x18E921: message_dispatch (mainloop.c:76) ==2694== by 0x48BB8E7: g_main_dispatch (gmain.c:3234) ==2694== by 0x48BB8E7: g_main_context_dispatch (gmain.c:3887) ==2694== by 0x48BBC77: g_main_context_iterate.isra.30 (gmain.c:3960) ==2694== by 0x48BBFD7: g_main_loop_run (gmain.c:4156) ==2694== by 0x119391: main (main.c:851) Change-Id: I3d86724c44b1593e5444a65eb7519bc150e50ee5 Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
-rw-r--r--gsupplicant/supplicant.c10
-rwxr-xr-xsrc/network.c2
-rwxr-xr-xsrc/service.c10
3 files changed, 15 insertions, 7 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 49d391fe..5fedf023 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -1657,7 +1657,6 @@ static void merge_network(GSupplicantNetwork *network)
GString *str;
const char *ssid, *mode, *key_mgmt;
#if defined TIZEN_EXT
- GSupplicantInterface *interface;
const char *isHS20AP;
const char *eap, *identity, *phase2;
#endif
@@ -1672,7 +1671,6 @@ static void merge_network(GSupplicantNetwork *network)
eap = g_hash_table_lookup(network->config_table, "eap");
identity = g_hash_table_lookup(network->config_table, "identity");
phase2 = g_hash_table_lookup(network->config_table, "phase2");
- interface = network->interface;
#endif
SUPPLICANT_DBG("ssid %s mode %s", ssid, mode);
@@ -1731,11 +1729,9 @@ static void merge_network(GSupplicantNetwork *network)
} else
network->isHS20AP = 0;
- if (interface)
- interface->network_path = g_strdup(network->path);
-
network->group = g_strdup(group);
callback_network_merged(network);
+ g_free(network->group);
#endif
g_free(group);
@@ -4918,6 +4914,10 @@ static void interface_add_network_result(const char *error,
SUPPLICANT_DBG("PATH: %s", path);
+#if defined TIZEN_EXT
+ if (interface->network_path)
+ g_free(interface->network_path);
+#endif
interface->network_path = g_strdup(path);
store_network_information(interface, data->ssid);
diff --git a/src/network.c b/src/network.c
index c5b5c974..e189955c 100755
--- a/src/network.c
+++ b/src/network.c
@@ -2105,6 +2105,7 @@ unsigned char *connman_network_get_countrycode(struct connman_network *network)
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;
@@ -2439,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;
}
diff --git a/src/service.c b/src/service.c
index b0424618..cf8ccaac 100755
--- a/src/service.c
+++ b/src/service.c
@@ -786,11 +786,17 @@ static int service_load(struct connman_service *service)
dns_method = g_key_file_get_string(keyfile, service->identifier,
"Nameservers.IPv4method", NULL);
- service->dns_config_method_ipv4 = __connman_dnsconfig_string2method(dns_method);
+ if (dns_method) {
+ service->dns_config_method_ipv4 = __connman_dnsconfig_string2method(dns_method);
+ g_free(dns_method);
+ }
dns_method = g_key_file_get_string(keyfile, service->identifier,
"Nameservers.IPv6method", NULL);
- service->dns_config_method_ipv6 = __connman_dnsconfig_string2method(dns_method);
+ if (dns_method) {
+ service->dns_config_method_ipv6 = __connman_dnsconfig_string2method(dns_method);
+ g_free(dns_method);
+ }
#endif
service->timeservers_config = g_key_file_get_string_list(keyfile,