diff --git a/src/shared/bap.c b/src/shared/bap.c
index 4dce32e..63c4c05 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
bt_bap_detach(bap);
}
-static struct bt_bap *bap_get_session(struct bt_att *att, struct gatt_db *db)
+struct bt_bap *bt_bap_get_session(struct bt_att *att, struct gatt_db *db)
{
const struct queue_entry *entry;
struct bt_bap *bap;
}
bap = bt_bap_new(db, NULL);
+ if (!bap)
+ return NULL;
+
bap->att = att;
bt_bap_attach(bap, NULL);
struct bt_ascs_ase_status rsp;
if (ase)
- bap = bap_get_session(att, ase->ascs->bdb->db);
+ bap = bt_bap_get_session(att, ase->ascs->bdb->db);
if (bap)
ep = bap_get_endpoint(bap->local_eps, bap->ldb, attrib);
void *user_data)
{
struct bt_ascs *ascs = user_data;
- struct bt_bap *bap = bap_get_session(att, ascs->bdb->db);
+ struct bt_bap *bap = bt_bap_get_session(att, ascs->bdb->db);
struct iovec iov = {
.iov_base = (void *) value,
.iov_len = len,
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 359147b..198ae50 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
bt_bap_destroy_func_t destroy);
bool bt_bap_bcode_cb_unregister(struct bt_bap *bap, unsigned int id);
+
+struct bt_bap *bt_bap_get_session(struct bt_att *att, struct gatt_db *db);