Fix uninitialized variable in case append_buffer fails with out of memory due to buffer copy allocation

git-svn-id: http://pugixml.googlecode.com/svn/trunk@941 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
arseny.kapoulkine@gmail.com 2012-12-07 06:56:31 +00:00
parent 7b61ad6379
commit 30549910db

View file

@ -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;