esp_hid: fix memory leak if getting dev reports fails

This commit is contained in:
David Cermak 2020-05-06 15:24:33 +02:00 committed by bot
parent d7fb9d54ba
commit 65b993234d

View File

@ -301,6 +301,7 @@ esp_err_t esp_hidh_dev_reports_get(esp_hidh_dev_t *dev, size_t *num_reports, esp
for (uint8_t i = 0; i < dev->reports_len; i++) {
if (dr == NULL) {
//error
free(r);
return ESP_FAIL;
}
r[i].map_index = dr->map_index;