From 9a03cf31208ed283f2bc6400ee8f8062754c3cea Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Thu, 20 Oct 2016 14:08:58 +0900 Subject: [PATCH] [WGID-144187/144188] Fixed memory leak Change-Id: I262adf24db8ef91e2ec79bbd890eef7dceea4156 Signed-off-by: Seonah Moon --- packaging/wifi-efl-ug.spec | 2 +- sources/libraries/Common/common_ip_info.c | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/packaging/wifi-efl-ug.spec b/packaging/wifi-efl-ug.spec index 2b91175..c8bbe2f 100644 --- a/packaging/wifi-efl-ug.spec +++ b/packaging/wifi-efl-ug.spec @@ -1,7 +1,7 @@ %define _unpackaged_files_terminate_build 0 Name: wifi-efl-ug Summary: Wi-Fi UI Gadget for TIZEN -Version: 1.0.205 +Version: 1.0.206 Release: 1 Group: App/Network License: Flora-1.1 diff --git a/sources/libraries/Common/common_ip_info.c b/sources/libraries/Common/common_ip_info.c index 2fc7573..de79ba6 100755 --- a/sources/libraries/Common/common_ip_info.c +++ b/sources/libraries/Common/common_ip_info.c @@ -1447,7 +1447,7 @@ void ip_info_save_data(full_ip_info_t *ip_data) } if (WIFI_IP_CONFIG_TYPE_STATIC == ip_info_list_data->ip_type) { - txt = get_ip_info_text(ENTRY_TYPE_IP_ADDR); + txt = g_strdup(get_ip_info_text(ENTRY_TYPE_IP_ADDR)); if (!txt) txt = g_strdup(DEFAULT_GUIDE_IP); if (g_strcmp0(prev_ip_info->ip_addr, txt) != 0) { @@ -1458,8 +1458,9 @@ void ip_info_save_data(full_ip_info_t *ip_data) ip_data->is_info_changed = TRUE; } free_ip_info_text(ENTRY_TYPE_IP_ADDR); + g_free(txt); - txt = get_ip_info_text(ENTRY_TYPE_SUBNET_MASK); + txt = g_strdup(get_ip_info_text(ENTRY_TYPE_SUBNET_MASK)); if (!txt) txt = g_strdup(DEFAULT_GUIDE_IP); if (g_strcmp0(prev_ip_info->subnet_mask, txt) != 0) { @@ -1470,8 +1471,9 @@ void ip_info_save_data(full_ip_info_t *ip_data) ip_data->is_info_changed = TRUE; } free_ip_info_text(ENTRY_TYPE_SUBNET_MASK); + g_free(txt); - txt = get_ip_info_text(ENTRY_TYPE_GATEWAY); + txt = g_strdup(get_ip_info_text(ENTRY_TYPE_GATEWAY)); if (!txt) txt = g_strdup(DEFAULT_GUIDE_IP); if (g_strcmp0(prev_ip_info->gateway_addr, txt) != 0) { @@ -1482,8 +1484,9 @@ void ip_info_save_data(full_ip_info_t *ip_data) ip_data->is_info_changed = TRUE; } free_ip_info_text(ENTRY_TYPE_GATEWAY); + g_free(txt); - txt = get_ip_info_text(ENTRY_TYPE_DNS_1); + txt = g_strdup(get_ip_info_text(ENTRY_TYPE_DNS_1)); if (!txt) txt = g_strdup(DEFAULT_GUIDE_IP); if (g_strcmp0(prev_ip_info->dns_1, txt) != 0) { @@ -1494,8 +1497,9 @@ void ip_info_save_data(full_ip_info_t *ip_data) ip_data->is_info_changed = TRUE; } free_ip_info_text(ENTRY_TYPE_DNS_1); + g_free(txt); - txt = get_ip_info_text(ENTRY_TYPE_DNS_2); + txt = g_strdup(get_ip_info_text(ENTRY_TYPE_DNS_2)); if (!txt) txt = g_strdup(DEFAULT_GUIDE_IP); if (g_strcmp0(prev_ip_info->dns_2, txt) != 0) { @@ -1506,16 +1510,17 @@ void ip_info_save_data(full_ip_info_t *ip_data) ip_data->is_info_changed = TRUE; } free_ip_info_text(ENTRY_TYPE_DNS_2); + g_free(txt); } - proxy_addr = get_ip_info_text(ENTRY_TYPE_PROXY_ADDR); + proxy_addr =g_strdup(get_ip_info_text(ENTRY_TYPE_PROXY_ADDR)); if (proxy_addr == NULL) { DEBUG_LOG(UG_NAME_NORMAL, "Set proxy type - auto"); if (prev_ip_info->proxy_type != WIFI_PROXY_TYPE_AUTO) { wifi_ap_set_proxy_type(ap, WIFI_PROXY_TYPE_AUTO); } } else { - proxy_port = txt = get_ip_info_text(ENTRY_TYPE_PROXY_PORT); + proxy_port = g_strdup(get_ip_info_text(ENTRY_TYPE_PROXY_PORT)); if (proxy_port) { txt = g_strdup_printf("%s:%s", proxy_addr, proxy_port); } else { @@ -1532,7 +1537,14 @@ void ip_info_save_data(full_ip_info_t *ip_data) free_ip_info_text(ENTRY_TYPE_PROXY_ADDR); free_ip_info_text(ENTRY_TYPE_PROXY_PORT); + g_free(proxy_port); + proxy_port = NULL; + g_free(txt); } + txt = NULL; + + g_free(proxy_addr); + proxy_addr = NULL; /* ip_info_print_values(ap); */ -- 2.7.4