summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-04-10 10:06:47 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-04-10 10:06:47 +0000
commitc95b553a81dc92bb7d7da603445f567e4dc7bfb3 (patch)
treefe4a64165aed082dea8b6cc185d1c2408a87b242
parent1e37455c1b73161e189867ba204c530052f70af7 (diff)
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
-rw-r--r--src/pugixml.cpp24
1 files changed, 18 insertions, 6 deletions
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();