mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix memory leak in esp_bt_hidh_dev_report_write and esp_bt_hidh_dev_set_report in bt_hidh.c
Closes https://github.com/espressif/esp-idf/issues/9323
This commit is contained in:
parent
68225b63de
commit
c2f9a0ad87
@ -803,8 +803,13 @@ static esp_err_t esp_bt_hidh_dev_report_write(esp_hidh_dev_t *dev, size_t map_in
|
||||
data = p_data;
|
||||
len = len + 1;
|
||||
}
|
||||
|
||||
ret = esp_bt_hid_host_send_data(dev->bda, data, len);
|
||||
if (p_data) {
|
||||
free(p_data);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -845,11 +850,17 @@ static esp_err_t esp_bt_hidh_dev_set_report(esp_hidh_dev_t *dev, size_t map_inde
|
||||
data = p_data;
|
||||
len = len + 1;
|
||||
}
|
||||
|
||||
ret = esp_bt_hid_host_set_report(dev->bda, report_type, data, len);
|
||||
if (p_data) {
|
||||
free(p_data);
|
||||
}
|
||||
|
||||
if (ret == ESP_OK) {
|
||||
set_trans(dev, ESP_HID_TRANS_SET_REPORT);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user