summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorSeonah Moon <seonah1.moon@samsung.com>2018-04-03 17:58:49 +0900
committerSeonah Moon <seonah1.moon@samsung.com>2018-04-03 18:19:03 +0900
commitd80b68f2fe85bfd82e423b4d69ae75b7a6925d6e (patch)
treed98bd2f21c8f91af8ea4532099c91344196126ce /sources
parent7ea090f1879b8741f5e12a3d7224d64080fd5255 (diff)
downloadwifi-d80b68f2fe85bfd82e423b4d69ae75b7a6925d6e.tar.gz
wifi-d80b68f2fe85bfd82e423b4d69ae75b7a6925d6e.tar.bz2
wifi-d80b68f2fe85bfd82e423b4d69ae75b7a6925d6e.zip
[CID-110975, 109003, 113729, 105793] Fix memory leak
Change-Id: I767d0a48541619d2e496415885b7e5538b9022aa
Diffstat (limited to 'sources')
-rwxr-xr-xsources/wearable/src/net/wifi_manager.c11
-rw-r--r--sources/wearable/src/wearable-circle/app_main.c6
2 files changed, 14 insertions, 3 deletions
diff --git a/sources/wearable/src/net/wifi_manager.c b/sources/wearable/src/net/wifi_manager.c
index 317df1c..cdaa562 100755
--- a/sources/wearable/src/net/wifi_manager.c
+++ b/sources/wearable/src/net/wifi_manager.c
@@ -1374,6 +1374,7 @@ void wifi_ap_set_proxy_manual(wifi_ap_object *ap_obj)
gchar *wifi_ap_get_proxy_address(wifi_ap_object *ap_obj)
{
gchar *proxy_address = NULL;
+ gchar *address = NULL;
char *saveptr = NULL;
WIFI_RET_VAL_IF_FAIL(ap_obj != NULL, NULL);
@@ -1382,13 +1383,16 @@ gchar *wifi_ap_get_proxy_address(wifi_ap_object *ap_obj)
WIFI_LOG_INFO("Proxy address is NULL.");
return NULL;
}
+ address = g_strdup(strtok_r(proxy_address, ":", &saveptr));
+ g_free(proxy_address);
- return g_strdup(strtok_r(proxy_address, ":", &saveptr));
+ return address;
}
gchar *wifi_ap_get_proxy_port(wifi_ap_object *ap_obj)
{
gchar *proxy_address = NULL;
+ gchar *port = NULL;
char *saveptr = NULL;
WIFI_RET_VAL_IF_FAIL(ap_obj != NULL, NULL);
@@ -1399,7 +1403,10 @@ gchar *wifi_ap_get_proxy_port(wifi_ap_object *ap_obj)
}
strtok_r(proxy_address, ":", &saveptr);
- return g_strdup(strtok_r(NULL, ":", &saveptr));
+ port = g_strdup(strtok_r(NULL, ":", &saveptr));
+ g_free(proxy_address);
+
+ return port;
}
void wifi_ap_set_proxy_address(wifi_ap_object *ap_obj, const gchar *proxy_address)
diff --git a/sources/wearable/src/wearable-circle/app_main.c b/sources/wearable/src/wearable-circle/app_main.c
index 5210baa..cd33cab 100644
--- a/sources/wearable/src/wearable-circle/app_main.c
+++ b/sources/wearable/src/wearable-circle/app_main.c
@@ -908,12 +908,15 @@ static gboolean _is_removable_ap(wifi_manager_object *manager, wifi_ap_object *a
{
wifi_manager_csccode code = WIFI_MANAGER_CSC_UNKNOWN;
wifi_manager_error_e error = wifi_get_csccode(manager, &code);
- gchar *ssid = wifi_ap_get_ssid(ap);
+ gchar *ssid = NULL;
wifi_manager_security_type_e security_type = wifi_ap_get_security_type(ap);
gboolean is_removable_ap = TRUE;
WIFI_RET_VAL_IF_FAIL(error == WIFI_MANAGER_ERROR_NONE, TRUE);
+
+ ssid = wifi_ap_get_ssid(ap);
WIFI_RET_VAL_IF_FAIL(ssid != NULL, TRUE);
+
if (code == WIFI_MANAGER_CSC_SKT) {
WIFI_LOG_INFO("Target is SKT.");
if (!g_strcmp0(ssid, "SK_VoIP")) {
@@ -5791,6 +5794,7 @@ static bool __found_specific_ap_callback(wifi_manager_ap_h ap, void *user_data)
WIFI_LOG_ERR("AP create failed.");
wifi_address_free(app_obj->address_for_hidden_ap);
app_obj->address_for_hidden_ap = NULL;
+ g_free(ap_name);
return FALSE;
}
g_free(ap_name);