Fix a memory leak 22/188822/1 accepted/tizen/unified/20180912.061655 submit/tizen/20180911.120738
authorhyunuktak <hyunuk.tak@samsung.com>
Tue, 11 Sep 2018 00:44:36 +0000 (09:44 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Tue, 11 Sep 2018 00:44:38 +0000 (09:44 +0900)
Change-Id: I1a32004a8aaea706156e9e53d304b9f149081a0d
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
plugin/tether/stc-plugin-tether.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 2641509..f1278f9
@@ -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);