diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index e8262cd..a5590b2 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
return NULL;
found:
- chan->session = avdtp_new(NULL, device, server->seps);
+ chan->session = avdtp_new(chan->io, device, server->seps);
if (!chan->session) {
channel_remove(chan);
return NULL;
goto fail;
}
- chan->session = avdtp_new(chan->io, chan->device, chan->server->seps);
if (!chan->session) {
- error("Unable to create AVDTP session");
- goto fail;
+ chan->session = avdtp_new(chan->io, chan->device,
+ chan->server->seps);
+ if (!chan->session) {
+ error("Unable to create AVDTP session");
+ goto fail;
+ }
}
g_io_channel_unref(chan->io);