Fix NULL dereference issue 13/172413/2
authorWootak Jung <wootak.jung@samsung.com>
Wed, 14 Mar 2018 00:48:43 +0000 (09:48 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 14 Mar 2018 04:14:41 +0000 (13:14 +0900)
Change-Id: I2c2ec27c180425cbe7727bf85813dd6f3af73092

bt-api/bt-common.c

index cbf31d5..40f7fd1 100644 (file)
@@ -1940,12 +1940,17 @@ GVariant *_bt_get_managed_objects(void)
                        BT_MANAGER_INTERFACE,
                        NULL, &error);
 
-       if (manager_proxy == NULL && error) {
+       if (error) {
                BT_ERR("Unable to create proxy: %s", error->message);
                g_clear_error(&error);
+               if (manager_proxy)
+                       g_object_unref(manager_proxy);
                return NULL;
        }
 
+       if (!manager_proxy)
+               return NULL;
+
        result = g_dbus_proxy_call_sync(manager_proxy,
                        "GetManagedObjects", NULL,
                        G_DBUS_CALL_FLAGS_NONE, -1,