Skip to content

Commit

Permalink
Update extensions/http-curl/client/HTTPClient.cpp
Browse files Browse the repository at this point in the history
Co-authored-by: Márton Szász <[email protected]>
  • Loading branch information
martinzink and szaszm authored Jan 11, 2022
1 parent fe26bcc commit a699475
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extensions/http-curl/client/HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ void HTTPClient::setContentType(std::string content_type) {
}

std::string HTTPClient::escape(std::string string_to_escape) {
char* escaped_chars = curl_easy_escape(http_session_, string_to_escape.c_str(), gsl::narrow<int>(string_to_escape.length()));
std::string escaped_string(escaped_chars);
curl_free(escaped_chars);
struct curl_deleter { void operator()(void* p) noexcept { curl_free(p); } };
std::unique_ptr<char, curl_deleter> escaped_chars{curl_easy_escape(http_session_, string_to_escape.c_str(), gsl::narrow<int>(string_to_escape.length()))};
std::string escaped_string(escaped_chars.get());
return escaped_string;
}

Expand Down

0 comments on commit a699475

Please sign in to comment.