Skip to content

Commit c82abe5

Browse files
authored
Merge pull request #651 from cdunn2001/fix-578
Avoid memory error
2 parents 6062f9b + 74438d1 commit c82abe5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/lib_json/json_reader.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ Reader::Reader(const Features& features)
103103

104104
bool
105105
Reader::parse(const std::string& document, Value& root, bool collectComments) {
106-
JSONCPP_STRING documentCopy(document.data(), document.data() + document.capacity());
107-
std::swap(documentCopy, document_);
106+
document_.assign(document.begin(), document.end());
108107
const char* begin = document_.c_str();
109108
const char* end = begin + document_.length();
110109
return parse(begin, end, root, collectComments);

0 commit comments

Comments
 (0)