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 <changlongx.xie@intel.com>
dbus_error_free(&derr);
- if (auth->agent != NULL)
+ if (auth->agent != NULL) {
+ agent_cancel(auth->agent);
agent_unref(auth->agent);
+ }
g_free(auth);
}
g_queue_remove(auth->adapter->auths, auth);
- if (auth->agent)
+ if (auth->agent) {
+ agent_cancel(auth->agent);
agent_unref(auth->agent);
+ }
g_free(auth);
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);
g_free(bonding->cb_iter);
if (bonding->agent) {
+ agent_cancel(bonding->agent);
agent_unref(bonding->agent);
bonding->agent = NULL;
}