From 34f32461e04b53df6523ac5fd15bff3e4cb7b7ab Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 18 Dec 2012 10:14:48 +0200 Subject: [PATCH] core: Fix initiating pairing without a registered agent --- src/device.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/device.c b/src/device.c index 047c26ae7..ade7583f0 100644 --- a/src/device.c +++ b/src/device.c @@ -1408,7 +1408,9 @@ static struct bonding_req *bonding_request_new(DBusMessage *msg, bonding = g_new0(struct bonding_req, 1); bonding->msg = dbus_message_ref(msg); - bonding->agent = agent_ref(agent); + + if (agent) + bonding->agent = agent_ref(agent); return bonding; } @@ -1462,7 +1464,8 @@ static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg, bonding = bonding_request_new(msg, device, agent); - agent_unref(agent); + if (agent) + agent_unref(agent); bonding->listener_id = g_dbus_add_disconnect_watch( btd_get_dbus_connection(), -- 2.47.3