1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-14 01:57:24 +03:00

F #6275: Fix mem leak in HttpRequest (#2749)

This commit is contained in:
Pavel Czerný 2023-09-25 17:54:26 +02:00 committed by GitHub
parent 5b68006368
commit 598e0bc91c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,6 +67,7 @@ int HttpRequest::post_json(const std::string& url, const std::string& data, std:
{
response = curl_easy_strerror(ec);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return -1;
@ -74,6 +75,7 @@ int HttpRequest::post_json(const std::string& url, const std::string& data, std:
auto rc = check_http_code(curl, response);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc;
@ -112,6 +114,7 @@ int HttpRequest::get_json(const std::string& url, std::string& response)
{
response = curl_easy_strerror(ec);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return -1;
@ -119,6 +122,7 @@ int HttpRequest::get_json(const std::string& url, std::string& response)
auto rc = check_http_code(curl, response);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc;