summaryrefslogtreecommitdiff
path: root/Source/Core/Common/HttpRequest.cpp
diff options
context:
space:
mode:
authorspycrab <spycrab@users.noreply.github.com>2019-04-06 13:23:55 +0200
committerspycrab <spycrab@users.noreply.github.com>2019-04-06 13:27:49 +0200
commitca5eac0c63b10a961d8350040a0eb683a4ce52b6 (patch)
tree873129012bef9792c0ea216c5e6e084b1ffebd4c /Source/Core/Common/HttpRequest.cpp
parent23986d48f731fd92e8989b32988f636118c9d2ba (diff)
Common/HttpRequest: Fix EscapeComponent leaking memory
Diffstat (limited to 'Source/Core/Common/HttpRequest.cpp')
-rw-r--r--Source/Core/Common/HttpRequest.cpp6
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)