Bluetooth: l2cap: Fix SDU buffer leak

`ret` is the amount sent from the current buffer. `sent` contains the
total amount that was transferred in the while loop.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This commit is contained in:
Jonathan Rico 2024-04-15 15:06:30 +02:00 committed by Alberto Escolar
parent becf4c1c81
commit 0794b22c9c

View file

@ -2017,7 +2017,7 @@ static int l2cap_chan_le_send_sdu(struct bt_l2cap_le_chan *ch,
sent += ret;
/* If the current buffer has been fully consumed, destroy it */
if (ret == rem_len) {
if (sent == rem_len) {
net_buf_unref(buf);
}
}