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 3160b8c4c7ff8db4e0f9badcdf7df684b151e077
Author: Szymon Janc <[email protected]>
AuthorDate: Mon Jun 30 16:48:09 2025 +0200

    nimble/gap: Check if conn is present if with asserts disabled
    
    BLE_HS_DBG_ASSERT is not enabled by default, and that code is
    already handling error path.
---
 nimble/host/src/ble_gap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c
index 64f96bd27..baa010e0b 100644
--- a/nimble/host/src/ble_gap.c
+++ b/nimble/host/src/ble_gap.c
@@ -2092,6 +2092,9 @@ ble_gap_rx_conn_complete(struct ble_gap_conn_complete 
*evt, uint8_t instance)
     /* We verified that there is a free connection when the procedure began. */
     conn = ble_hs_conn_alloc(evt->connection_handle);
     BLE_HS_DBG_ASSERT(conn != NULL);
+    if (conn == NULL) {
+        return BLE_HS_ENOMEM;
+    }
 
     conn->bhc_itvl = evt->conn_itvl;
     conn->bhc_latency = evt->conn_latency;

Reply via email to