Skip to content

Commit

Permalink
Merge pull request #7962 from spycrab/httprequest_ec_memleak
Browse files Browse the repository at this point in the history
Common/HttpRequest: Fix EscapeComponent leaking memory
  • Loading branch information
spycrab committed Apr 6, 2019
2 parents 23986d4 + ca5eac0 commit b47f09c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Source/Core/Common/HttpRequest.cpp
Expand Up @@ -167,7 +167,11 @@ void HttpRequest::Impl::FollowRedirects(long max)


std::string HttpRequest::Impl::EscapeComponent(const std::string& string) std::string HttpRequest::Impl::EscapeComponent(const std::string& string)
{ {
return curl_easy_escape(m_curl.get(), string.c_str(), static_cast<int>(string.size())); char* escaped = curl_easy_escape(m_curl.get(), string.c_str(), static_cast<int>(string.size()));
std::string escaped_str(escaped);
curl_free(escaped);

return escaped_str;
} }


static size_t CurlWriteCallback(char* data, size_t size, size_t nmemb, void* userdata) static size_t CurlWriteCallback(char* data, size_t size, size_t nmemb, void* userdata)
Expand Down

0 comments on commit b47f09c

Please sign in to comment.