Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sources/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,9 @@ namespace WebDAV
{
pugi::xml_node href = response.node().select_node("*[local-name()='href']").node();
std::string encode_file_name = href.first_child().value();
std::string resource_path = curl_unescape(encode_file_name.c_str(), static_cast<int>(encode_file_name.length()));
char* unescaped = curl_unescape(encode_file_name.c_str(), static_cast<int>(encode_file_name.length())); //this allocates new memory
std::string resource_path{unescaped}; // the data is copied
curl_free(unescaped);
auto target_path = target_urn.path();
auto target_path_without_sep = target_urn.path();
if (!target_path_without_sep.empty() && target_path_without_sep.back() == '/')
Expand Down
4 changes: 3 additions & 1 deletion sources/urn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ namespace WebDAV

auto escape(void* request, const string& name) -> string
{
string path = curl_easy_escape(request, name.c_str(), static_cast<int>(name.length()));
char * escaped = curl_easy_escape(request, name.c_str(), static_cast<int>(name.length())); // allocates new memory
string path{escaped}; // this copies the data
curl_free(escaped); // must free the memory
return path;
}

Expand Down