summaryrefslogtreecommitdiffstats
path: root/audio/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/main.c')
-rw-r--r--audio/main.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/audio/main.c b/audio/main.c
index c3b5bb56..1678b58d 100644
--- a/audio/main.c
+++ b/audio/main.c
@@ -128,23 +128,32 @@ static int audio_init(void)
if (unix_init() < 0) {
error("Unable to setup unix socket");
- return -EIO;
+ goto failed;
}
- if (audio_manager_init(connection, config) < 0) {
- dbus_connection_unref(connection);
- return -EIO;
- }
+ if (audio_manager_init(connection, config) < 0)
+ goto failed;
sco_server = bt_io_listen(BT_IO_SCO, sco_server_cb, NULL, NULL,
NULL, NULL,
BT_IO_OPT_INVALID);
if (!sco_server) {
error("Unable to start SCO server socket");
- return -EIO;
+ goto failed;
}
return 0;
+
+failed:
+ audio_manager_exit();
+ unix_exit();
+
+ if (connection) {
+ dbus_connection_unref(connection);
+ connection = NULL;
+ }
+
+ return -EIO;
}
static void audio_exit(void)