From: Nishant Chaprana Date: Wed, 13 Jan 2016 03:48:44 +0000 (+0530) Subject: [Fixed] memory allocated using g_try_malloc0_n should be freed using g_free() X-Git-Tag: submit/tizen/20160216.061917^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F56828%2F1;p=platform%2Fcore%2Fapi%2Fwifi-direct.git [Fixed] memory allocated using g_try_malloc0_n should be freed using g_free() Change-Id: Icb9386bc375b583626472ac467adefae1a3ee540 Signed-off-by: Nishant Chaprana --- diff --git a/packaging/capi-network-wifi-direct.spec b/packaging/capi-network-wifi-direct.spec index 64d2499..39bb500 100644 --- a/packaging/capi-network-wifi-direct.spec +++ b/packaging/capi-network-wifi-direct.spec @@ -1,6 +1,6 @@ Name: capi-network-wifi-direct Summary: Network WiFi-Direct Library -Version: 1.2.45 +Version: 1.2.46 Release: 1 Group: Network & Connectivity/Wireless License: Apache-2.0 diff --git a/src/wifi-direct-client-proxy.c b/src/wifi-direct-client-proxy.c index 04464af..3fbe6c1 100755 --- a/src/wifi-direct-client-proxy.c +++ b/src/wifi-direct-client-proxy.c @@ -1746,7 +1746,7 @@ int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb cb, } pthread_mutex_unlock(&g_client_info.mutex); if (res <= 0) { - free(buff); + g_free(buff); WDC_LOGE("Failed to read socket"); __wfd_reset_control(); return WIFI_DIRECT_ERROR_OPERATION_FAILED; @@ -2139,7 +2139,7 @@ int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb cb, sizeof(wfd_connected_peer_info_s)); pthread_mutex_unlock(&g_client_info.mutex); if (res <= 0) { - free(buff); + g_free(buff); WDC_LOGE("socket read error"); __wfd_reset_control(); return WIFI_DIRECT_ERROR_OPERATION_FAILED; @@ -3735,7 +3735,7 @@ int wifi_direct_foreach_persistent_groups(wifi_direct_persistent_group_cb cb, } pthread_mutex_unlock(&g_client_info.mutex); if (res <= 0) { - free(buff); + g_free(buff); WDC_LOGE("socket read error."); __wfd_reset_control(); return WIFI_DIRECT_ERROR_OPERATION_FAILED; @@ -4263,11 +4263,11 @@ int wifi_direct_get_peer_info(char* mac_address, wifi_direct_discovered_peer_inf peer = (wifi_direct_discovered_peer_info_s *) g_try_malloc0(sizeof(wifi_direct_discovered_peer_info_s)); if (!peer) { - WDC_LOGE("Failed to alloc memory"); - pthread_mutex_unlock(&g_client_info.mutex); - g_free(buff); - return WIFI_DIRECT_ERROR_OPERATION_FAILED; - } + WDC_LOGE("Failed to alloc memory"); + pthread_mutex_unlock(&g_client_info.mutex); + g_free(buff); + return WIFI_DIRECT_ERROR_OPERATION_FAILED; + } peer->device_name = g_strdup(buff->device_name); peer->mac_address = (char*) g_try_malloc0(MACSTR_LEN); g_snprintf(peer->mac_address, MACSTR_LEN, MACSTR, MAC2STR(buff->mac_address));