slacking
slacking copied to clipboard
memory leaks
Hollo there!
I found memory leaks.
inline
std::string Session::easyEscape(const std::string& text) {
char *encoded_output = curl_easy_escape(curl_, text.c_str(), static_cast<int>(text.length()));
return std::string{encoded_output};
}
This code needs to free memory. For example like below.
inline
std::string Session::easyEscape(const std::string& text) {
char *encoded_output = curl_easy_escape(curl_, text.c_str(), static_cast<int>(text.length()));
const auto string = std::string{ encoded_output };
curl_free(encoded_output);
return string;
}
Good catch thanks, would you like to propose a PR so that you are contributor ?
For reference: https://curl.se/libcurl/c/curl_easy_escape.html