diff options
| author | spycrab <spycrab@users.noreply.github.com> | 2019-04-06 13:46:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-06 13:46:03 +0200 |
| commit | b47f09c26db2194af568e5f960e915d224e94f99 (patch) | |
| tree | 873129012bef9792c0ea216c5e6e084b1ffebd4c /Source/Core/Common/HttpRequest.cpp | |
| parent | 23986d48f731fd92e8989b32988f636118c9d2ba (diff) | |
| parent | ca5eac0c63b10a961d8350040a0eb683a4ce52b6 (diff) | |
Merge pull request #7962 from spycrab/httprequest_ec_memleak
Common/HttpRequest: Fix EscapeComponent leaking memory
Diffstat (limited to 'Source/Core/Common/HttpRequest.cpp')
| -rw-r--r-- | Source/Core/Common/HttpRequest.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/Core/Common/HttpRequest.cpp b/Source/Core/Common/HttpRequest.cpp index ab3fd11c34..88f6a126fb 100644 --- a/Source/Core/Common/HttpRequest.cpp +++ b/Source/Core/Common/HttpRequest.cpp @@ -167,7 +167,11 @@ void HttpRequest::Impl::FollowRedirects(long max) 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) |
