diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 7e5c2a12dcfdefdf28fe3eb5b379fdc492ef7aaa..edc03d646ab457a3769ed3ed2208f591a6c6cd82 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -4558,12 +4558,14 @@ namespace pugi _root->name = 0; // parse - xml_parse_result res = impl::load_buffer_impl(doc, _root, const_cast<void*>(contents), size, options, encoding, false, false, &extra->buffer); + char_t* buffer = 0; + xml_parse_result res = impl::load_buffer_impl(doc, _root, const_cast<void*>(contents), size, options, encoding, false, false, &buffer); // restore name _root->name = rootname; // add extra buffer to the list + extra->buffer = buffer; extra->next = doc->extra_buffers; doc->extra_buffers = extra;