mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-11-03 11:02:46 +00:00
nimble/host: Fix mbuf leak on L2CAP
Make sure to free rx data if not passing it to channel callback.
This commit is contained in:
@@ -394,6 +394,7 @@ ble_l2cap_rx(uint16_t conn_handle, uint8_t pb, struct os_mbuf *om)
|
||||
|
||||
if (!chan) {
|
||||
ble_l2cap_sig_reject_invalid_cid_tx(conn_handle, 0, 0, rx_cid);
|
||||
os_mbuf_free_chain(rx_frags);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -406,11 +407,13 @@ ble_l2cap_rx(uint16_t conn_handle, uint8_t pb, struct os_mbuf *om)
|
||||
if (chan->dcid >= BLE_L2CAP_COC_CID_START &&
|
||||
chan->dcid <= BLE_L2CAP_COC_CID_END && rx_len > chan->my_coc_mps) {
|
||||
ble_l2cap_disconnect(chan);
|
||||
os_mbuf_free_chain(rx_frags);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
if (rx_len > ble_l2cap_get_mtu(chan)) {
|
||||
ble_l2cap_disconnect(chan);
|
||||
os_mbuf_free_chain(rx_frags);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user