summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2009-01-13 13:45:00 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2009-01-13 13:45:00 +0200
commitd2244495dfc50c22ce275f6194c19d3293de70cb (patch)
tree6c476147947b1be0eb3b5e02eb027fde533c868b
parent4d80133a45dd1d405dd8a23afdfae82690d30fe6 (diff)
Fix dbus_connection_ref/unref usage
-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) {