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(string.size())); + char* escaped = curl_easy_escape(m_curl.get(), string.c_str(), static_cast(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)