fix minor memory leak in AsyncWebRequest

This commit is contained in:
dankmeme01 2024-03-09 12:10:42 +01:00
parent 709a6a3b3b
commit 52ea6ea51c

View file

@ -381,6 +381,10 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const
); );
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data);
auto res = curl_easy_perform(curl); auto res = curl_easy_perform(curl);
// free the header list
curl_slist_free_all(headers);
long code = 0; long code = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code);
if (res != CURLE_OK) { if (res != CURLE_OK) {
@ -396,7 +400,6 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
return this->error(response_str, code); return this->error(response_str, code);
} }
curl_slist_free_all(headers);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
AWAIT_RESUME(); AWAIT_RESUME();