From: hyunuktak Date: Tue, 11 Sep 2018 00:44:36 +0000 (+0900) Subject: Fix a memory leak X-Git-Tag: accepted/tizen/unified/20180912.061655^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fstc-manager.git;a=commitdiff_plain;h=e84a61cd98b1feee0503035f12fff31c7c535f69 Fix a memory leak Change-Id: I1a32004a8aaea706156e9e53d304b9f149081a0d Signed-off-by: hyunuktak --- diff --git a/plugin/tether/stc-plugin-tether.c b/plugin/tether/stc-plugin-tether.c old mode 100644 new mode 100755 index 2641509..f1278f9 --- a/plugin/tether/stc-plugin-tether.c +++ b/plugin/tether/stc-plugin-tether.c @@ -181,16 +181,16 @@ static void _mobileap_signal_cb(GDBusConnection *conn, STC_LOGI("%s interface(%s)", sig, interface); - sta = (tether_sta_info_s *)g_malloc0(sizeof(tether_sta_info_s)); - if (sta == NULL) { - STC_LOGE("g_malloc0 failed"); - return; - } - g_variant_get(param, "(susssu)", &state, &type, &ip, &mac, &hostname, &tm); STC_LOGI("%s: ip(%s) mac(%s) name(%s) tm(%d)", state, ip, mac, hostname, tm); if (!g_strcmp0(state, "DhcpConnected")) { + sta = (tether_sta_info_s *)g_malloc0(sizeof(tether_sta_info_s)); + if (sta == NULL) { + STC_LOGE("g_malloc0 failed"); + return; + } + g_strlcpy(sta->ip, ip, INET_ADDRSTRLEN); g_strlcpy(sta->mac, mac, STATION_MAC_STR_LEN); g_strlcpy(sta->name, hostname, STATION_STR_HOSTNAME_LEN);