Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory leaks #15

Open
assistar opened this issue Sep 16, 2022 · 1 comment
Open

memory leaks #15

assistar opened this issue Sep 16, 2022 · 1 comment

Comments

@assistar
Copy link

assistar commented Sep 16, 2022

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;
}
@coin-au-carre
Copy link
Owner

coin-au-carre commented Nov 6, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants