mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-25 03:10:01 +00:00
nimble/eatt: Fix NULL deref in ble_eatt_alloc
If ble_eatt_conn_pool was empty we would end up in writing NULL address.
This commit is contained in:
@@ -177,10 +177,13 @@ ble_eatt_alloc(void)
|
||||
struct ble_eatt *eatt;
|
||||
|
||||
eatt = os_memblock_get(&ble_eatt_conn_pool);
|
||||
if (eatt) {
|
||||
SLIST_INSERT_HEAD(&g_ble_eatt_list, eatt, next);
|
||||
if (!eatt) {
|
||||
BLE_EATT_LOG_WARN("eatt: Failed to allocate new eatt context\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SLIST_INSERT_HEAD(&g_ble_eatt_list, eatt, next);
|
||||
|
||||
eatt->conn_handle = BLE_HS_CONN_HANDLE_NONE;
|
||||
eatt->chan = NULL;
|
||||
eatt->client_op = 0;
|
||||
|
||||
Reference in New Issue
Block a user