summaryrefslogtreecommitdiff
path: root/src/pugixpath.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pugixpath.cpp')
-rw-r--r--src/pugixpath.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp
index e866c4f..1e20d8c 100644
--- a/src/pugixpath.cpp
+++ b/src/pugixpath.cpp
@@ -514,9 +514,17 @@ namespace
else
{
// need to make dummy on-heap copy
- string_t copy(begin, end);
+ char_t* copy = static_cast<char_t*>(get_memory_allocation_function()((length + 1) * sizeof(char_t)));
+ if (!copy) return gen_nan(); // $$ out of memory
- return convert_string_to_number(copy.c_str());
+ memcpy(copy, begin, length * sizeof(char_t));
+ copy[length] = 0;
+
+ double result = convert_string_to_number(copy);
+
+ get_memory_deallocation_function()(copy);
+
+ return result;
}
}