diff --git a/singleheader/simdjson.cpp b/singleheader/simdjson.cpp index 2a85f24db..e99a48fe1 100644 --- a/singleheader/simdjson.cpp +++ b/singleheader/simdjson.cpp @@ -1618,7 +1618,7 @@ ParsedJson::iterator::iterator(const iterator &o): current_val(o.current_val), depthindex(nullptr) { depthindex = new scopeindex_t[pj.depthcapacity]; if(depthindex != nullptr) { - memcpy(o.depthindex, depthindex, pj.depthcapacity * sizeof(depthindex[0])); + memcpy(depthindex, o.depthindex, pj.depthcapacity * sizeof(depthindex[0])); } else { tape_length = 0; } diff --git a/src/parsedjsoniterator.cpp b/src/parsedjsoniterator.cpp index b85cf31d8..044acab6d 100644 --- a/src/parsedjsoniterator.cpp +++ b/src/parsedjsoniterator.cpp @@ -34,7 +34,7 @@ ParsedJson::iterator::iterator(const iterator &o): current_val(o.current_val), depthindex(nullptr) { depthindex = new scopeindex_t[pj.depthcapacity]; if(depthindex != nullptr) { - memcpy(o.depthindex, depthindex, pj.depthcapacity * sizeof(depthindex[0])); + memcpy(depthindex, o.depthindex, pj.depthcapacity * sizeof(depthindex[0])); } else { tape_length = 0; }