diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index f2ba61d8d2ea..f9820c137576 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -571,7 +571,11 @@ static void att_send_process(struct bt_att *att) } } - if (err < 0) { + if (err == -ENOTCONN) { + /* If we are not connected anymore, free the buffer */ + BT_ERR("Freeing buf %p id %d", buf, net_buf_id(buf)); + net_buf_unref(buf); + } else if (err < 0) { /* Push it back if it could not be send */ k_queue_prepend(&att->tx_queue._queue, buf); }