diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c index 6dcb8bd1d..3e24e42b6 100644 --- a/nimble/host/src/ble_gap.c +++ b/nimble/host/src/ble_gap.c @@ -2967,6 +2967,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;