From 1c06e272495987a95f53a640cbc64f78b036167e Mon Sep 17 00:00:00 2001 From: hyunuktak Date: Tue, 3 Apr 2018 09:48:20 +0900 Subject: [PATCH] Fixed some coverity for resource leak Change-Id: I18d828bd6b10af992adc48333a962787831df7b0 Signed-off-by: hyunuktak --- packaging/capi-network-wifi-manager.spec | 2 +- src/network_interface.c | 4 ++-- test/wifi_manager_test.c | 6 ++++++ tool/wifi_mgr_public.c | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packaging/capi-network-wifi-manager.spec b/packaging/capi-network-wifi-manager.spec index 77f6f76..fee1932 100755 --- a/packaging/capi-network-wifi-manager.spec +++ b/packaging/capi-network-wifi-manager.spec @@ -1,6 +1,6 @@ Name: capi-network-wifi-manager Summary: Network Wi-Fi library in TIZEN C API -Version: 1.0.33 +Version: 1.0.34 Release: 1 Group: System/Network License: Apache-2.0 diff --git a/src/network_interface.c b/src/network_interface.c index c6c1d2d..40703af 100755 --- a/src/network_interface.c +++ b/src/network_interface.c @@ -498,9 +498,9 @@ static int __net_extract_common_info(const char *key, GVariant *variant, net_pro else if (g_strcmp0(dns_type, "ipv6.dhcp") == 0) net_info->DnsConfigType6 = NET_DNS_CONFIG_TYPE_DYNAMIC; + g_free(dns_type); } } - g_free(dns_type); g_variant_iter_free(iter); net_info->DnsCount = dnsCount; @@ -545,9 +545,9 @@ static int __net_extract_common_info(const char *key, GVariant *variant, net_pro else if (g_strcmp0(dns_type, "ipv6.dhcp") == 0) net_info->DnsConfigType6 = NET_DNS_CONFIG_TYPE_DYNAMIC; + g_free(dns_type); } } - g_free(dns_type); g_variant_iter_free(iter); net_info->DnsCount = dnsCount; diff --git a/test/wifi_manager_test.c b/test/wifi_manager_test.c index c48a82b..16a2037 100755 --- a/test/wifi_manager_test.c +++ b/test/wifi_manager_test.c @@ -532,6 +532,7 @@ static bool __test_found_eap_ap_callback(wifi_manager_ap_h ap, void *user_data) if (rv != WIFI_MANAGER_ERROR_NONE) { printf("Fail to set eap type : %s\n", __test_convert_error_to_string(rv)); g_free(ap_name); + g_free(inputed_name); return false; } @@ -544,6 +545,7 @@ static bool __test_found_eap_ap_callback(wifi_manager_ap_h ap, void *user_data) printf("Fail to set eap certificatefile : %s\n", __test_convert_error_to_string(rv)); g_free(ap_name); + g_free(inputed_name); return false; } } @@ -562,6 +564,7 @@ static bool __test_found_eap_ap_callback(wifi_manager_ap_h ap, void *user_data) printf("Fail to set eap auth type : %s\n", __test_convert_error_to_string(rv)); g_free(ap_name); + g_free(inputed_name); return false; } @@ -714,6 +717,7 @@ static bool __test_found_change_ip_method_callback(wifi_manager_ap_h ap, void *u if (rv == false || (address_type != 0 && address_type != 1)) { printf("Invalid input!!\n"); + g_free(ap_name); return false; } @@ -920,6 +924,7 @@ static bool __test_found_change_proxy_method_callback(wifi_manager_ap_h ap, void if (rv == false || (address_type != 0 && address_type != 1)) { printf("Invalid input!!\n"); + g_free(ap_name); return false; } @@ -1118,6 +1123,7 @@ static bool __test_found_print_ap_info_callback(wifi_manager_ap_h ap, void *user if (rv == false || (address_type != 0 && address_type != 1)) { printf("Invalid input!!\n"); + g_free(ap_name); return false; } diff --git a/tool/wifi_mgr_public.c b/tool/wifi_mgr_public.c index abee5ee..76c4f80 100755 --- a/tool/wifi_mgr_public.c +++ b/tool/wifi_mgr_public.c @@ -254,6 +254,7 @@ static int _test_public_get_connected_ap(MManager *mm, struct menu_data *menu) msg(HR_SINGLE); + FREE(essid); return ret; } -- 2.7.4