Remove waring message when calling CHECK_PRIVILEGE 40/190340/1 accepted/tizen/5.0/unified/20181102.013612 accepted/tizen/unified/20181001.150852 submit/tizen/20181001.075826 submit/tizen_5.0/20181101.000002
authorsaerome.kim <saerome.kim@samsung.com>
Mon, 1 Oct 2018 06:19:25 +0000 (15:19 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 1 Oct 2018 06:19:25 +0000 (15:19 +0900)
Even if g_dbus_proxy_call_sync() returns NULL, g_variant_unref() calles.
So, we checkout if returned variable is null or not.

Change-Id: Idef3bce2021b71c690ed8055acb8b3fdb8a6cf60
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
src/zbl-dbus.c

index d8d8e40..29e0ce5 100644 (file)
@@ -3483,7 +3483,9 @@ static int _check_zigbee_privilege()
 
        variant = g_dbus_proxy_call_sync(service_gproxy, "check_privilege",
                        NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &dbus_err);
-       if (!variant) {
+       if (variant) {
+               g_variant_unref(variant);
+       } else if (dbus_err) {
                ERR("Failed to check_zigbee_privilege [%s]", dbus_err->message);
                if (strstr(dbus_err->message, "AccessDenied"))
                        result = ZIGBEE_ERROR_PERMISSION_DENIED;
@@ -3492,7 +3494,6 @@ static int _check_zigbee_privilege()
 
                g_error_free(dbus_err);
        }
-       g_variant_unref(variant);
 
        return result;
 }