diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2009-03-12 11:44:38 -0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-03-12 11:44:38 -0300 |
commit | 1f393331ef64660e614cb21be347b7bebfcff2ed (patch) | |
tree | 377d6ea0ed90b492fb3bdd9a71d979c7b764f5e6 /audio/main.c | |
parent | c4c03a457df6ad3708bf6abc8ad0a9d7edf3b454 (diff) |
Fix audio plugin initialization failure cases
Diffstat (limited to 'audio/main.c')
-rw-r--r-- | audio/main.c | 21 |
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) |