From c95b553a81dc92bb7d7da603445f567e4dc7bfb3 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Fri, 10 Apr 2009 10:06:47 +0000 Subject: Fixed destroying of attribute/node name/values (it now uses custom deallocation function, if any) git-svn-id: http://pugixml.googlecode.com/svn/trunk@121 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixml.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/pugixml.cpp b/src/pugixml.cpp index ac2308e..ea37320 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -114,8 +114,17 @@ namespace pugi void destroy() { - if (!name_insitu) delete[] name; - if (!value_insitu) delete[] value; + if (!name_insitu) + { + global_deallocate(name); + name = 0; + } + + if (!value_insitu) + { + global_deallocate(value); + value = 0; + } } bool name_insitu : 1; @@ -144,13 +153,13 @@ namespace pugi if (!name_insitu) { - delete[] name; + global_deallocate(name); name = 0; } if (!value_insitu) { - delete[] value; + global_deallocate(value); value = 0; } @@ -2876,8 +2885,11 @@ namespace pugi void xml_document::destroy() { - global_deallocate(_buffer); - _buffer = 0; + if (_buffer) + { + global_deallocate(_buffer); + _buffer = 0; + } if (_root) _root->destroy(); -- cgit v1.2.3