fix(esp_http_server): fix memory leak in httpd_req_async_handler_begin

Free scratch memory when response headers allocation fails
This commit is contained in:
Salvatore Mesoraca
2025-08-28 00:50:30 +02:00
parent 2044fba6e7
commit fd33d02563

View File

@@ -675,6 +675,7 @@ esp_err_t httpd_req_async_handler_begin(httpd_req_t *r, httpd_req_t **out)
async_aux->resp_hdrs = calloc(hd->config.max_resp_headers, sizeof(struct resp_hdr));
if (async_aux->resp_hdrs == NULL) {
free(async_aux->scratch);
free(async_aux);
free(async);
return ESP_ERR_NO_MEM;