slacking icon indicating copy to clipboard operation
slacking copied to clipboard

memory leaks

Open assistar opened this issue 2 years ago • 1 comments

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;
}

assistar avatar Sep 16 '22 01:09 assistar

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

coin-au-carre avatar Nov 06 '22 00:11 coin-au-carre