From 4bca0f3d3391663febc88e10ffde94044916fb6b Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Thu, 3 Oct 2019 15:04:58 +0200 Subject: [PATCH] Bluetooth: ATT: Fix disconnected ATT not releasing buffers Fix bug in ATT reset handling, not releasing queued notification buffers when the connection is terminated. Signed-off-by: Joakim Andersson --- subsys/bluetooth/host/att.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 88cabf86d81..a83c1950475 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -2054,18 +2054,18 @@ static void att_reset(struct bt_att *att) { struct bt_att_req *req, *tmp; int i; -#if CONFIG_BT_ATT_PREPARE_COUNT > 0 struct net_buf *buf; +#if CONFIG_BT_ATT_PREPARE_COUNT > 0 /* Discard queued buffers */ while ((buf = k_fifo_get(&att->prep_queue, K_NO_WAIT))) { net_buf_unref(buf); } +#endif /* CONFIG_BT_ATT_PREPARE_COUNT > 0 */ while ((buf = k_fifo_get(&att->tx_queue, K_NO_WAIT))) { net_buf_unref(buf); } -#endif atomic_set_bit(att->flags, ATT_DISCONNECTED);