summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2012-12-07 06:56:31 +0000
committerarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2012-12-07 06:56:31 +0000
commit30549910db4e65328a5ea671b57b4fc20a98551f (patch)
tree0e10cf1916baf04433543ecdbb03b1d5ed9c2b9f
parent7b61ad637920b082d6c23c4495234ce788ad4ed1 (diff)
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
-rw-r--r--src/pugixml.cpp4
1 files changed, 3 insertions, 1 deletions
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<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;