Remove waring message when calling CHECK_PRIVILEGE 56/190356/1 accepted/tizen/4.0/unified/20181004.120028 submit/tizen_4.0/20181001.080238
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 07:40:05 +0000 (07:40 +0000)
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>
(cherry picked from commit 749559fea356c66286a2638fe5fd00fdf6014002)

src/zbl-dbus.c

index d8d8e40870b4c5989baefb72c77456e06adf5f90..29e0ce5673770b32d111b0a41f8ce36f8b2b15d9 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;
 }