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 0caf9baeb271ede85fcc5237ab87ddbf938600da
Author: Szymon Janc <[email protected]>
AuthorDate: Mon Jun 30 16:50:29 2025 +0200

    nimble/host: Check if HCI command buffer was allocated
    
    BLE_HS_DBG_ASSERT is not enabled by default, and that code is
    already handling error path.
---
 nimble/host/src/ble_hs_hci_cmd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/nimble/host/src/ble_hs_hci_cmd.c b/nimble/host/src/ble_hs_hci_cmd.c
index 689cb1765..9d1ecf9ca 100644
--- a/nimble/host/src/ble_hs_hci_cmd.c
+++ b/nimble/host/src/ble_hs_hci_cmd.c
@@ -51,6 +51,9 @@ ble_hs_hci_cmd_send(uint16_t opcode, uint8_t len, const void 
*cmddata)
 
     cmd = ble_transport_alloc_cmd();
     BLE_HS_DBG_ASSERT(cmd != NULL);
+    if (cmd == NULL) {
+        return BLE_HS_ENOMEM;
+    }
 
     cmd->opcode = htole16(opcode);
     cmd->length = len;

Reply via email to