mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/fix_esp_hid_auth_fail_crash_v4.3' into 'release/v4.3'
Fix esp hid crash when auth failed (backport v4.3) See merge request espressif/esp-idf!20613
This commit is contained in:
commit
9040964321
@ -112,6 +112,8 @@ static void read_device_services(esp_gatt_if_t gattc_if, esp_hidh_dev_t *dev)
|
|||||||
ESP_LOGE(TAG, "malloc report maps failed");
|
ESP_LOGE(TAG, "malloc report maps failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/* read characteristic value may failed, so we should init report maps */
|
||||||
|
memset(dev->config.report_maps, 0, dev->config.report_maps_len * sizeof(esp_hid_raw_report_map_t));
|
||||||
|
|
||||||
for (uint16_t s = 0; s < dcount; s++) {
|
for (uint16_t s = 0; s < dcount; s++) {
|
||||||
suuid = service_result[s].uuid.uuid.uuid16;
|
suuid = service_result[s].uuid.uuid.uuid16;
|
||||||
|
@ -370,7 +370,10 @@ static void esp_hidh_dev_resources_free(esp_hidh_dev_t *dev)
|
|||||||
free((void *)dev->config.manufacturer_name);
|
free((void *)dev->config.manufacturer_name);
|
||||||
free((void *)dev->config.serial_number);
|
free((void *)dev->config.serial_number);
|
||||||
for (uint8_t d = 0; d < dev->config.report_maps_len; d++) {
|
for (uint8_t d = 0; d < dev->config.report_maps_len; d++) {
|
||||||
free((void *)dev->config.report_maps[d].data);
|
/* data of report map maybe is NULL */
|
||||||
|
if (dev->config.report_maps[d].data) {
|
||||||
|
free((void *)dev->config.report_maps[d].data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
free((void *)dev->config.report_maps);
|
free((void *)dev->config.report_maps);
|
||||||
esp_hidh_dev_report_t *r;
|
esp_hidh_dev_report_t *r;
|
||||||
|
Loading…
Reference in New Issue
Block a user