summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/agent.c1
-rw-r--r--src/device.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/src/agent.c b/src/agent.c
index 8784db3f..ae0d958e 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -782,6 +782,7 @@ gboolean agent_is_busy(struct agent *agent, void *user_data)
void agent_exit(void)
{
dbus_connection_unref(connection);
+ connection = NULL;
}
void agent_init(void)
diff --git a/src/device.c b/src/device.c
index c81c4c2b..b6d8695f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1278,8 +1278,10 @@ int device_browse(struct btd_device *device, DBusConnection *conn,
req = g_new0(struct browse_req, 1);
- req->conn = conn ? dbus_connection_ref(conn) : get_dbus_connection();
+ if (conn == NULL)
+ conn = get_dbus_connection();
+ req->conn = dbus_connection_ref(conn);
req->device = device;
if (search) {