summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2008-09-04 15:58:54 -0300
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2008-09-05 16:08:30 -0300
commitd8b05b91dc415169a60ee23609bd83bc3b4a2136 (patch)
treea3201758f3e0fa1a887a52233816d41649101fde /audio
parent40c45f2330725c32563e110474a91d1fe1109088 (diff)
Audio: Missing DBusConnection unref
Diffstat (limited to 'audio')
-rw-r--r--audio/main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/audio/main.c b/audio/main.c
index 9afc61e6..bf0e4884 100644
--- a/audio/main.c
+++ b/audio/main.c
@@ -29,7 +29,6 @@
#include <errno.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
-#include <bluetooth/sdp.h>
#include <glib.h>
#include <dbus/dbus.h>
@@ -40,6 +39,8 @@
#include "device.h"
#include "manager.h"
+static DBusConnection *connection = NULL;
+
static GKeyFile *load_config_file(const char *file)
{
GError *err = NULL;
@@ -59,11 +60,10 @@ static GKeyFile *load_config_file(const char *file)
static int audio_init(void)
{
- DBusConnection *conn;
GKeyFile *config;
- conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
- if (conn == NULL)
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (connection == NULL)
return -EIO;
config = load_config_file(CONFIGDIR "/audio.conf");
@@ -73,8 +73,8 @@ static int audio_init(void)
return -EIO;
}
- if (audio_manager_init(conn, config) < 0) {
- dbus_connection_unref(conn);
+ if (audio_manager_init(connection, config) < 0) {
+ dbus_connection_unref(connection);
return -EIO;
}
@@ -86,6 +86,8 @@ static void audio_exit(void)
audio_manager_exit();
unix_exit();
+
+ dbus_connection_unref(connection);
}
BLUETOOTH_PLUGIN_DEFINE("audio", audio_init, audio_exit)