We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a6872d commit 1c8fe67Copy full SHA for 1c8fe67
subsys/bluetooth/host/l2cap.c
@@ -1971,12 +1971,12 @@ static int l2cap_chan_le_send(struct bt_l2cap_le_chan *ch,
1971
BT_WARN("Unable to send seg %d", err);
1972
atomic_inc(&ch->tx.credits);
1973
1974
- /* If the segment is not the original buffer release it since it
1975
- * won't be needed anymore.
+ /* The host takes ownership of the reference in seg when
+ * bt_l2cap_send_cb is successful. The call returned an error,
1976
+ * so we must get rid of the reference that was taken in
1977
+ * l2cap_chan_create_seg.
1978
*/
- if (seg != buf) {
- net_buf_unref(seg);
1979
- }
+ net_buf_unref(seg);
1980
1981
if (err == -ENOBUFS) {
1982
/* Restore state since segment could not be sent */
0 commit comments