From 30549910db4e65328a5ea671b57b4fc20a98551f Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine@gmail.com" Date: Fri, 7 Dec 2012 06:56:31 +0000 Subject: 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 --- src/pugixml.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 7e5c2a1..edc03d6 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(contents), size, options, encoding, false, false, &extra->buffer); + char_t* buffer = 0; + xml_parse_result res = impl::load_buffer_impl(doc, _root, const_cast(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; -- cgit v1.2.3