This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit a41b4570d6f22636ec65bbb94907bf5861765673
Author: Szymon Janc <[email protected]>
AuthorDate: Fri Mar 15 10:44:50 2024 +0100

    nimble/host: Fix possible memory leak in ble_eatt_prepare_rx_sdu
    
    ble_l2cap_recv_ready consumes om buffer only on success.
---
 nimble/host/src/ble_eatt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/nimble/host/src/ble_eatt.c b/nimble/host/src/ble_eatt.c
index 721c94608..2ef62a80a 100644
--- a/nimble/host/src/ble_eatt.c
+++ b/nimble/host/src/ble_eatt.c
@@ -148,6 +148,12 @@ ble_eatt_prepare_rx_sdu(struct ble_l2cap_chan *chan)
     }
 
     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;
 }
 

Reply via email to