Skip to content

Commit 9006194

Browse files
ya1gauravcdunn2001
authored andcommitted
Fix uninitialized value detected by valgrind
Fix issue reported in #578 For std::string variable, length() is more readable than size().
1 parent 6062f9b commit 9006194

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib_json/json_reader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +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());
106+
JSONCPP_STRING documentCopy(document.data(), document.data() + document.length());
107107
std::swap(documentCopy, document_);
108108
const char* begin = document_.c_str();
109109
const char* end = begin + document_.length();

0 commit comments

Comments
 (0)