summaryrefslogtreecommitdiffstats
path: root/network
diff options
context:
space:
mode:
Diffstat (limited to 'network')
-rw-r--r--network/main.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/network/main.c b/network/main.c
index 6efdb81d..2307a165 100644
--- a/network/main.c
+++ b/network/main.c
@@ -32,16 +32,17 @@
#include "plugin.h"
#include "manager.h"
+static DBusConnection *connection = NULL;
+
static int network_init(void)
{
- DBusConnection *conn;
- conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
- if (conn == NULL)
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (connection == NULL)
return -EIO;
- if (network_manager_init(conn) < 0) {
- dbus_connection_unref(conn);
+ if (network_manager_init(connection) < 0) {
+ dbus_connection_unref(connection);
return -EIO;
}
@@ -51,6 +52,7 @@ static int network_init(void)
static void network_exit(void)
{
network_manager_exit();
+ dbus_connection_unref(connection);
}
BLUETOOTH_PLUGIN_DEFINE("network", network_init, network_exit)