diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index e77db5d..164c72d 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
switch (bt_bap_stream_get_state(stream)) {
case BT_BAP_STREAM_STATE_IDLE:
- case BT_BAP_STREAM_STATE_RELEASING:
return true;
+ case BT_BAP_STREAM_STATE_RELEASING:
+ return false;
default:
bt_bap_stream_release(stream, NULL, NULL);
return false;
static void setup_free(void *data)
{
struct bap_setup *setup = data;
+ bool closing = setup->closing;
DBG("%p", setup);
setup_ready(setup, -ECANCELED, 0);
- if (setup->closing && setup->close_cb)
+ if (closing && setup->close_cb)
setup->close_cb(setup, setup->close_cb_data);
if (setup->stream && setup->id) {
bt_bap_stream_unlock(setup->stream);
- release_stream(setup->stream);
+ if (!closing) {
+ /* Release if not already done */
+ release_stream(setup->stream);
+ }
if (setup->ep)
bap_update_cigs(setup->ep->data);