Skip to content

Commit 004270d

Browse files
committed
Avoid memory error
But simply use `.assign()` instead of the extra copy. (See comment from @BillyDonhue at #580.) fixes #578 closes #580
1 parent 9006194 commit 004270d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/lib_json/json_reader.cpp

+1-2
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.length());
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)