Fix memory leak 08/159308/1
authortaesub kim <taesub.kim@samsung.com>
Wed, 8 Nov 2017 06:42:43 +0000 (15:42 +0900)
committertaesub kim <taesub.kim@samsung.com>
Wed, 8 Nov 2017 06:42:51 +0000 (15:42 +0900)
Change-Id: I06bf6a5fdb1b5a63c252fc6769dd1d2a6c1f71a6
Signed-off-by: Taesub Kim <taesub.kim@samsung.com>
src/wifi-indicator.c

index 1c99a18..86fd4d8 100755 (executable)
@@ -82,22 +82,16 @@ static int __netconfig_wifi_update_and_get_rssi(void)
        }
 
        message = netconfig_invoke_dbus_method(SUPPLICANT_SERVICE, if_path,
-                               SUPPLICANT_INTERFACE ".Interface", "SignalPoll", NULL);
-
-       g_free(if_path);
+                       SUPPLICANT_INTERFACE ".Interface", "SignalPoll", NULL);
        if (message == NULL) {
                ERR("Fail to get SignalPoll from wpa_supplicant");
+               g_free(if_path);
                return 0;
        }
 
        g_variant_get(message, "(v)", &value);
 
        g_variant_get(value, "a{sv}", &iter);
-       if (iter == NULL) {
-               ERR("Fail to get list from SignalPoll");
-               return 0;
-       }
-
        while (g_variant_iter_loop(iter, "{sv}", &key, &variant)) {
                key_value = g_variant_get_int32(variant);
 
@@ -115,6 +109,10 @@ static int __netconfig_wifi_update_and_get_rssi(void)
        if (value)
                g_variant_unref(value);
 
+       g_variant_unref(message);
+
+       g_free(if_path);
+
        netconfig_wifi_rssi = rssi_dbm;
 
        return rssi_dbm;