From c29c661d919f7155e6ca0c4fb6e364523eb9122f Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 28 Oct 2014 13:31:26 +0200 Subject: [PATCH] Revert "core: Fix unnecessary calls to agent_cancel()" agent_cancel calls are necessary since agent_unref only call it in case the last reference is dropped. Taken from upstream: http://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=a67b0480a2c45b0d11e4db4142fc95fb36287dda Change-Id: Ie50bc59bdb33ea7e711c4ae244c7dcf8c83c0b47 Signed-off-by: Changlong Xie --- src/adapter.c | 8 ++++++-- src/agent.c | 1 + src/device.c | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/adapter.c b/src/adapter.c index a3722e2..60a0ad8 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -1076,8 +1076,10 @@ static void service_auth_cancel(struct service_auth *auth) dbus_error_free(&derr); - if (auth->agent != NULL) + if (auth->agent != NULL) { + agent_cancel(auth->agent); agent_unref(auth->agent); + } g_free(auth); } @@ -4782,8 +4784,10 @@ int btd_cancel_authorization(guint id) g_queue_remove(auth->adapter->auths, auth); - if (auth->agent) + if (auth->agent) { + agent_cancel(auth->agent); agent_unref(auth->agent); + } g_free(auth); diff --git a/src/agent.c b/src/agent.c index d23550f..b05e529 100644 --- a/src/agent.c +++ b/src/agent.c @@ -349,6 +349,7 @@ static void simple_agent_reply(DBusPendingCall *call, void *user_data) if (dbus_error_has_name(&err, DBUS_ERROR_NO_REPLY)) { error("Timed out waiting for reply from agent"); + agent_cancel(agent); dbus_message_unref(message); dbus_error_free(&err); agent_unref(agent); diff --git a/src/device.c b/src/device.c index d55b9cd..fd0485a 100644 --- a/src/device.c +++ b/src/device.c @@ -1861,6 +1861,7 @@ static void bonding_request_free(struct bonding_req *bonding) g_free(bonding->cb_iter); if (bonding->agent) { + agent_cancel(bonding->agent); agent_unref(bonding->agent); bonding->agent = NULL; } -- 2.7.4