fix(ble_mesh): fix memory issue in nimble gap event forwarding

(cherry picked from commit aeab65c1a7)

Co-authored-by: luoxu <luoxu@espressif.com>
This commit is contained in:
Luo Xu
2025-12-15 17:43:28 +08:00
parent bc646511dd
commit d536847cad
2 changed files with 6 additions and 1 deletions
@@ -97,6 +97,9 @@ typedef union {
#if CONFIG_BLE_MESH_USE_BLE_50 && CONFIG_BT_NIMBLE_ENABLED
/**
* @brief Event parameters of ESP_BLE_MESH_NIMBLE_GAP_EVENT_EVT
* @note The execution environment of this event is different
* from other BLE Mesh events, as it runs in the NimBLE Host's
* execution environment.
*/
struct ble_mesh_nimble_gap_event_evt_param {
struct ble_gap_event event; /*!< GAP event parameters for NimBLE Host */
@@ -14,6 +14,8 @@
#include "esp_ble_mesh_ble_api.h"
#if (CONFIG_BLE_MESH_BLE_COEX_SUPPORT || CONFIG_BLE_MESH_USE_BLE_50)
static inline void btc_ble_mesh_ble_cb_to_app(esp_ble_mesh_ble_cb_event_t event,
esp_ble_mesh_ble_cb_param_t *param);
static void btc_ble_mesh_ble_copy_req_data(btc_msg_t *msg, void *p_dst, void *p_src)
{
#if CONFIG_BLE_MESH_SUPPORT_BLE_SCAN
@@ -99,7 +101,7 @@ void bt_mesh_ble_nimble_evt_to_btc(struct ble_gap_event *event, void *arg)
memcpy(&param.nimble_gap_evt.event, event, sizeof(struct ble_gap_event));
param.nimble_gap_evt.arg = arg;
btc_ble_mesh_ble_callback(&param, ESP_BLE_MESH_NIMBLE_GAP_EVENT_EVT);
btc_ble_mesh_ble_cb_to_app(ESP_BLE_MESH_NIMBLE_GAP_EVENT_EVT, &param);
}
#endif /* CONFIG_BT_NIMBLE_ENABLED && CONFIG_BLE_MESH_USE_BLE_50 */