mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-29 15:14:31 +08:00
Audio: Missing DBusConnection unref
This commit is contained in:
parent
40c45f2330
commit
d8b05b91dc
14
audio/main.c
14
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)
|
||||
|
Loading…
Reference in New Issue
Block a user