Bluetooth: L2CAP: Fix not unrefing tx_buf

If the channel has a tx_buf it must be unrefed when destroying the
channel.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2019-11-19 15:34:53 +02:00 committed by Johan Hedberg
commit 3f43413887

View file

@ -751,6 +751,11 @@ static void l2cap_chan_destroy(struct bt_l2cap_chan *chan)
/* Cancel ongoing work */
k_delayed_work_cancel(&chan->rtx_work);
if (ch->tx_buf) {
net_buf_unref(ch->tx_buf);
ch->tx_buf = NULL;
}
/* Remove buffers on the TX queue */
while ((buf = net_buf_get(&ch->tx_queue, K_NO_WAIT))) {
net_buf_unref(buf);