From 30549910db4e65328a5ea671b57b4fc20a98551f Mon Sep 17 00:00:00 2001
From: "arseny.kapoulkine@gmail.com"
 <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>
Date: Fri, 7 Dec 2012 06:56:31 +0000
Subject: [PATCH] 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 7e5c2a12..edc03d64 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;
 
-- 
GitLab