send2vinnie / pugixml

Automatically exported from code.google.com/p/pugixml
0 stars 0 forks source link

_root is ised then checked for NULL #210

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Found a tiny problem in void xml_document::destroy() -

   for (impl::xml_extra_buffer* extra = static_cast<impl::xml_document_struct*>(_root)->extra_buffers; extra; extra = extra->next)
   {
       if (extra->buffer) impl::xml_memory::deallocate(extra->buffer);
   }

   // destroy dynamic storage, leave sentinel page (it's in static memory)
   if (_root)
   {
      ...        

_root is used in for, but only then it is checked for being a null

Original issue reported on code.google.com by aviacons...@gmail.com on 1 Aug 2013 at 1:24

GoogleCodeExporter commented 9 years ago
Thanks for catching this! _root in xml_document is never null for valid 
programs; I've replaced null check with an assertion and slightly cleaned up 
destroy(), r955.

Original comment by arseny.k...@gmail.com on 2 Aug 2013 at 2:46