From: Jaehyun Kim Date: Fri, 30 Sep 2022 03:40:06 +0000 (+0900) Subject: Fix resource leak that occur when getting IP X-Git-Tag: accepted/tizen/7.0/unified/20230126.170237~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=910b8a8f6bde3e75528ee95890a8f6f2cc88c585;p=platform%2Fcore%2Fapi%2Fwifi-manager.git Fix resource leak that occur when getting IP Change-Id: I7ad65f496f8d172f5b8edbb943cce773a1340c67 Signed-off-by: Jaehyun Kim --- diff --git a/include/wifi-manager.h b/include/wifi-manager.h index 8c81d49..7771739 100644 --- a/include/wifi-manager.h +++ b/include/wifi-manager.h @@ -2516,6 +2516,7 @@ int wifi_manager_ap_set_ip_config_type(wifi_manager_ap_h ap, * @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIFI_MANAGER_ERROR_OUT_OF_MEMORY Out of memory * @retval #WIFI_MANAGER_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Address family not supported + * @retval #WIFI_MANAGER_ERROR_NO_CONNECTION There is no connected AP * @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Not supported * @see wifi_manager_ap_foreach_ipv6_address() */ diff --git a/src/wifi_ap.c b/src/wifi_ap.c index 0fbfd69..a4c6c3e 100644 --- a/src/wifi_ap.c +++ b/src/wifi_ap.c @@ -945,6 +945,10 @@ EXPORT_API int wifi_manager_ap_get_ip_address(wifi_manager_ap_h ap, address_family); if (g_strcmp0(*ip_address, "0.0.0.0") == 0) { WIFI_LOG(WIFI_ERROR, "Invalid IP Address [%s]", *ip_address); //LCOV_EXCL_LINE + + g_free(*ip_address); + *ip_address = NULL; + __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE return WIFI_MANAGER_ERROR_NO_CONNECTION; //LCOV_EXCL_LINE }