diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 8ff879b..47764c8 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -4708,7 +4708,7 @@ PUGI__NS_BEGIN xml_encoding buffer_encoding = impl::get_buffer_encoding(encoding, contents, size); // if convert_buffer below throws bad_alloc, we still need to deallocate contents if we own it - auto_deleter contents_guard(own ? contents : NULL, xml_memory::deallocate); + auto_deleter contents_guard(own ? contents : 0, xml_memory::deallocate); // get private buffer char_t* buffer = 0; @@ -4718,7 +4718,7 @@ PUGI__NS_BEGIN if (!impl::convert_buffer(buffer, length, buffer_encoding, contents, size, is_mutable)) return impl::make_parse_result(status_out_of_memory); // after this we either deallocate contents (below) or hold on to it via doc->buffer, so we don't need to guard it - contents_guard.data = NULL; + contents_guard.release(); // delete original buffer if we performed a conversion if (own && buffer != contents && contents) impl::xml_memory::deallocate(contents);