nimble/host: Fix possible memory leak in ble_eatt_prepare_rx_sdu
ble_l2cap_recv_ready consumes om buffer only on success.
diff --git a/nimble/host/src/ble_eatt.c b/nimble/host/src/ble_eatt.c
index 721c946..2ef62a8 100644
--- a/nimble/host/src/ble_eatt.c
+++ b/nimble/host/src/ble_eatt.c
@@ -148,6 +148,12 @@
}
rc = ble_l2cap_recv_ready(chan, om);
+ if (rc) {
+ BLE_EATT_LOG_ERROR("eatt: Failed to supply RX SDU conn_handle 0x%04x (status=%d)\n",
+ chan->conn_handle, rc);
+ os_mbuf_free_chain(om);
+ }
+
return rc;
}